mirror of
https://github.com/acedanger/shell.git
synced 2025-12-06 01:10:12 -08:00
- Introduced `recover-plex-database.sh` for comprehensive database recovery with multiple strategies, logging, and rollback capabilities. - Added `restore-plex.sh` for safe restoration of Plex backups, including validation and dry-run options. - Created `plex-db-manager.sh` to consolidate database management functionalities, including integrity checks and service management. - Enhanced logging and error handling across all scripts for better user feedback and troubleshooting. - Implemented safety measures to prevent running scripts as root and ensure proper service management during operations.
45 lines
3.3 KiB
Plaintext
45 lines
3.3 KiB
Plaintext
# Enhanced Crontab Entries for Europa (Media Server)
|
|
#
|
|
# These entries include comprehensive logging to syslog with proper tags
|
|
# and error handling for better monitoring and troubleshooting
|
|
|
|
# Move the files previously backed up at 0100 (FROM racknerd TO europa)
|
|
# Logs both stdout and stderr with backup-move tag
|
|
0 1 * * * /home/acedanger/shell/move-backups.sh 2>&1 | logger -t backup-move -p user.info
|
|
|
|
# Daily .env files backup at 0200 with logging
|
|
# Backs up all Docker .env files to private Gitea repository
|
|
0 2 * * * { echo "Starting .env files backup"; /home/acedanger/shell/backup-env-files.sh; echo ".env backup completed with exit code: $?"; } 2>&1 | logger -t env-backup -p user.info
|
|
|
|
# DISABLED: Custom Plex backup system (June 21, 2025)
|
|
# Reason: Plex built-in scheduled backups are now handling database backups every 3 days
|
|
# Built-in backups location: /var/lib/plexmediaserver/.../Databases/*.backup.*
|
|
# Custom backups no longer needed - Plex's native system is more reliable
|
|
|
|
# Optional: Weekly database integrity check (read-only) - keeping for health monitoring
|
|
# 0 6 * * 0 { echo "Weekly Plex database integrity check (read-only)"; /home/acedanger/shell/plex/plex-db-manager.sh check; } 2>&1 | logger -t plex-health-check -p user.info
|
|
|
|
# DISABLED - Custom daily Plex backup (replaced by Plex built-in backups)
|
|
# 15 4 * * * { echo "Starting Plex backup"; /home/acedanger/shell/plex/backup-plex.sh --non-interactive --disable-auto-repair; echo "Plex backup completed with exit code: $?"; } 2>&1 | logger -t plex-backup -p user.info
|
|
|
|
# DISABLED - Custom backup validation (no longer needed with built-in backups)
|
|
# 0 7 * * * { echo "Starting Plex backup validation"; /home/acedanger/shell/plex/validate-plex-backups.sh --fix; echo "Validation completed with exit code: $?"; } 2>&1 | logger -t plex-validation -p user.info
|
|
|
|
# Backup Immich database weekly (Mondays at 0500)
|
|
# Enhanced with proper logging and error handling
|
|
0 5 * * 1 { echo "Starting Immich database backup move"; if mv /mnt/share/media/immich/uploads/backups/immich-db-backup* /mnt/share/media/backups/immich 2>/dev/null; then echo "Immich backup move completed successfully"; else echo "No Immich backup files found or move failed"; fi; } 2>&1 | logger -t immich-backup -p user.info
|
|
|
|
# Daily system backup at 0400 with auto-cleanup
|
|
0 4 * * * /home/acedanger/shell/crontab/crontab-backup-system.sh backup auto --auto-cleanup 2>&1 | logger -t crontab-backup -p user.info
|
|
|
|
# DISABLED - Weekly Plex backup report (no longer needed)
|
|
# 0 8 * * 0 { echo "Starting weekly Plex backup report generation"; /home/acedanger/shell/plex/validate-plex-backups.sh --report; echo "Weekly report generation completed with exit code: $?"; } 2>&1 | logger -t plex-report -p user.info
|
|
|
|
# Weekly .env backup validation (Sundays at 0830)
|
|
# Validates integrity of .env backup repository
|
|
30 8 * * 0 { echo "Starting .env backup validation"; /home/acedanger/shell/validate-env-backups.sh; echo ".env validation completed with exit code: $?"; } 2>&1 | logger -t env-validation -p user.info
|
|
|
|
# Optional: Add a health check entry to monitor cron jobs (every 6 hours)
|
|
# This can help detect if any of the backup processes are failing
|
|
# 0 */6 * * * { echo "Cron health check - all backup jobs scheduled"; ps aux | grep -E "(backup-plex|validate-plex|move-backups)" | grep -v grep | wc -l; } 2>&1 | logger -t cron-health -p user.info
|