mirror of
https://github.com/acedanger/shell.git
synced 2025-12-06 01:10:12 -08:00
feat: Add daily system backup and integrity check for Plex database with enhanced logging
This commit is contained in:
@@ -1 +1,2 @@
|
|||||||
0 0 * * * { echo "Starting Docker backup"; /home/acedanger/shell/backup-docker.sh; echo "Docker backup completed with exit code: $?"; } 2>&1 | logger -t docker-backup -p user.info
|
0 0 * * * { echo "Starting Docker backup"; /home/acedanger/shell/backup-docker.sh; echo "Docker backup completed with exit code: $?"; } 2>&1 | logger -t docker-backup -p user.info
|
||||||
|
0 4 * * * /home/acedanger/shell/crontab/crontab-backup-system.sh backup auto --auto-cleanup 2>&1 | logger -t crontab-backup -p user.info
|
||||||
|
|||||||
@@ -7,24 +7,27 @@
|
|||||||
# Logs both stdout and stderr with backup-move tag
|
# 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
|
0 1 * * * /home/acedanger/shell/move-backups.sh 2>&1 | logger -t backup-move -p user.info
|
||||||
|
|
||||||
|
# Daily Plex database integrity check every 30 minutes
|
||||||
|
*/30 * * * * { echo "Check Plex database corruption"; /home/acedanger/shell/plex/backup-plex.sh --check-integrity --auto-repair; } 2>&1 | logger -t plex-database-integrity-check -p user.info
|
||||||
|
|
||||||
# Daily Plex backup at 0415 with enhanced logging
|
# Daily Plex backup at 0415 with enhanced logging
|
||||||
# Includes execution status and performance metrics
|
# Includes execution status and performance metrics
|
||||||
15 4 * * * { echo "Starting Plex backup"; /home/acedanger/shell/plex/backup-plex.sh --non-interactive --auto-repair; echo "Plex backup completed with exit code: $?"; } 2>&1 | logger -t plex-backup -p user.info
|
15 4 * * * { echo "Starting Plex backup"; /home/acedanger/shell/plex/backup-plex.sh --non-interactive --auto-repair; echo "Plex backup completed with exit code: $?"; } 2>&1 | logger -t plex-backup -p user.info
|
||||||
|
|
||||||
# Daily validation at 0700 with detailed logging
|
# Daily validation at 0700 with detailed logging
|
||||||
# Logs validation results and any auto-fixes performed
|
# Logs validation results and any auto-fixes performed
|
||||||
0 7 * * * { echo "Starting Plex backup validation"; /home/acedanger/shell/validate-plex-backups.sh --fix; echo "Validation completed with exit code: $?"; } 2>&1 | logger -t plex-validation -p user.info
|
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)
|
# Backup Immich database weekly (Mondays at 0500)
|
||||||
# Enhanced with proper logging and error handling
|
# 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
|
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
|
||||||
|
|
||||||
# Generate detailed weekly report (Sundays at 0800)
|
# Generate detailed weekly report (Sundays at 0800)
|
||||||
# Comprehensive reporting with system logging
|
# Comprehensive reporting with system logging
|
||||||
0 8 * * 0 { echo "Starting weekly Plex backup report generation"; /home/acedanger/shell/validate-plex-backups.sh --report; echo "Weekly report generation completed with exit code: $?"; } 2>&1 | logger -t plex-report -p user.info
|
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
|
||||||
|
|
||||||
# Mount check and recovery (legacy from original crontab)
|
|
||||||
# @reboot sleep 30 && mount -a
|
|
||||||
|
|
||||||
# Optional: Add a health check entry to monitor cron jobs (every 6 hours)
|
# 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
|
# This can help detect if any of the backup processes are failing
|
||||||
|
|||||||
@@ -3,10 +3,12 @@
|
|||||||
# These entries include comprehensive logging to syslog with proper tags
|
# These entries include comprehensive logging to syslog with proper tags
|
||||||
# and error handling for better monitoring and troubleshooting
|
# and error handling for better monitoring and troubleshooting
|
||||||
|
|
||||||
# Daily Docker backup at midnight (original racknerd job)
|
|
||||||
# Enhanced with proper logging and error handling
|
# Enhanced with proper logging and error handling
|
||||||
0 0 * * * { echo "Starting Docker backup"; /home/acedanger/shell/backup-docker.sh; echo "Docker backup completed with exit code: $?"; } 2>&1 | logger -t docker-backup -p user.info
|
0 0 * * * { echo "Starting Docker backup"; /home/acedanger/shell/backup-docker.sh; echo "Docker backup completed with exit code: $?"; } 2>&1 | logger -t docker-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
|
||||||
|
|
||||||
# Optional: Add a health check entry to monitor backup jobs (every 6 hours)
|
# Optional: Add a health check entry to monitor backup jobs (every 6 hours)
|
||||||
# This can help detect if the backup process is failing
|
# This can help detect if the backup process is failing
|
||||||
# 0 */6 * * * { echo "Cron health check - Docker backup job scheduled"; ps aux | grep "backup-docker" | grep -v grep | wc -l; } 2>&1 | logger -t cron-health -p user.info
|
# 0 */6 * * * { echo "Cron health check - Docker backup job scheduled"; ps aux | grep "backup-docker" | grep -v grep | wc -l; } 2>&1 | logger -t cron-health -p user.info
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ verify_scripts_exist() {
|
|||||||
local scripts=(
|
local scripts=(
|
||||||
"/home/acedanger/shell/move-backups.sh"
|
"/home/acedanger/shell/move-backups.sh"
|
||||||
"/home/acedanger/shell/plex/backup-plex.sh"
|
"/home/acedanger/shell/plex/backup-plex.sh"
|
||||||
"/home/acedanger/shell/validate-plex-backups.sh"
|
"/home/acedanger/shell/plex/validate-plex-backups.sh"
|
||||||
)
|
)
|
||||||
|
|
||||||
local all_good=true
|
local all_good=true
|
||||||
|
|||||||
Reference in New Issue
Block a user