From df5b7acf3e310b85e1a6c13531e7f78982152d82 Mon Sep 17 00:00:00 2001 From: Anthony Date: Wed, 13 Nov 2024 02:29:16 +0800 Subject: [PATCH] JPS error fixes --- scripts/imports/manage_backup_schedule.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/imports/manage_backup_schedule.sh b/scripts/imports/manage_backup_schedule.sh index bf687d4..5e6319f 100644 --- a/scripts/imports/manage_backup_schedule.sh +++ b/scripts/imports/manage_backup_schedule.sh @@ -65,7 +65,7 @@ check_system_requirements() { if [ "$available_space" -lt "$required_space" ]; then log_action "ERROR: Insufficient disk space" return 1 - } + fi return 0 } @@ -108,9 +108,7 @@ add_update_cron_job() { fi # Prepare cron command with environment variables and error handling - local CMD="RESTIC_PASSWORD=\"$restic_password\" \ -LOG_FILE=\"${BACKUP_LOG_PREFIX}\$(date +\\%Y-\\%m-\\%d_\\%H-\\%M-\\%S).log\" \ -$BACKUP_SCRIPT > \"\$LOG_FILE\" 2>&1 || echo \"\$(date) Backup failed\" >> \"$ACTION_LOG_FILE\"" + local CMD="RESTIC_PASSWORD='$restic_password' LOG_FILE='${BACKUP_LOG_PREFIX}\$(date +\%Y-\%m-\%d_\%H-\%M-\%S).log' $BACKUP_SCRIPT > \"\$LOG_FILE\" 2>&1 || echo \"\$(date) Backup failed\" >> \"$ACTION_LOG_FILE\"" # Safely update crontab crontab -l 2>/dev/null | grep -v "$BACKUP_SCRIPT" > "$temp_crontab" || true @@ -193,4 +191,4 @@ main() { } # Execute main function with all arguments -main "$@" \ No newline at end of file +main "$@"