54 lines
1.8 KiB
Markdown
54 lines
1.8 KiB
Markdown
# Maintenance Scripts
|
|
|
|
This directory contains shell scripts for common maintenance tasks.
|
|
|
|
## Available Scripts
|
|
|
|
| Script | Description | Usage |
|
|
|--------|-------------|-------|
|
|
| `gpu-check.sh` | Verify GPU passthrough in containers | `./scripts/gpu-check.sh` |
|
|
| `health-check.sh` | Check all services and report status | `./scripts/health-check.sh` |
|
|
| `setup-kuma-monitors.sh` | Manual guide for configuring Uptime Kuma monitors | `./scripts/setup-kuma-monitors.sh` |
|
|
| `setup-kuma-monitors.py` | **Automated** Uptime Kuma monitor setup via API | `source .venv/bin/activate && python3 scripts/setup-kuma-monitors.py` |
|
|
| `backup-configs.sh` | Backup all Docker configs | `./scripts/backup-configs.sh` |
|
|
| `disk-usage.sh` | Report disk usage for SSD and HDD | `./scripts/disk-usage.sh` |
|
|
| `update-stacks.sh` | Pull latest images and update containers | `./scripts/update-stacks.sh <stack-name>` |
|
|
| `cleanup.sh` | Clean up unused Docker resources | `./scripts/cleanup.sh` |
|
|
|
|
## Making Scripts Executable
|
|
|
|
```bash
|
|
# Make all scripts executable
|
|
chmod +x scripts/*.sh
|
|
|
|
# Or individually
|
|
chmod +x scripts/health-check.sh
|
|
```
|
|
|
|
## Scheduling with Cron
|
|
|
|
Add to crontab for automated maintenance:
|
|
|
|
```bash
|
|
# Edit crontab
|
|
crontab -e
|
|
|
|
# Examples:
|
|
# Daily health check at 8 AM
|
|
0 8 * * * /home/jpmschweitzer/Projects/tower-of-joy/scripts/health-check.sh >> /var/log/tower-of-joy-health.log 2>&1
|
|
|
|
# Weekly cleanup on Sunday at 3 AM
|
|
0 3 * * 0 /home/jpmschweitzer/Projects/tower-of-joy/scripts/cleanup.sh
|
|
|
|
# Daily backup at 2 AM
|
|
0 2 * * * /home/jpmschweitzer/Projects/tower-of-joy/scripts/backup-configs.sh
|
|
```
|
|
|
|
## Script Guidelines
|
|
|
|
- All scripts should include error handling
|
|
- Use absolute paths for reliability
|
|
- Log output for debugging
|
|
- Exit with appropriate status codes (0 = success, non-zero = failure)
|
|
- Include help text with `-h` or `--help` flags
|