JPS error fixes

main
Anthony 2024-11-13 02:29:16 +08:00
parent 12226390a7
commit df5b7acf3e
1 changed files with 3 additions and 5 deletions

View File

@ -65,7 +65,7 @@ check_system_requirements() {
if [ "$available_space" -lt "$required_space" ]; then if [ "$available_space" -lt "$required_space" ]; then
log_action "ERROR: Insufficient disk space" log_action "ERROR: Insufficient disk space"
return 1 return 1
} fi
return 0 return 0
} }
@ -108,9 +108,7 @@ add_update_cron_job() {
fi fi
# Prepare cron command with environment variables and error handling # Prepare cron command with environment variables and error handling
local CMD="RESTIC_PASSWORD=\"$restic_password\" \ 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\""
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 # Safely update crontab
crontab -l 2>/dev/null | grep -v "$BACKUP_SCRIPT" > "$temp_crontab" || true crontab -l 2>/dev/null | grep -v "$BACKUP_SCRIPT" > "$temp_crontab" || true
@ -193,4 +191,4 @@ main() {
} }
# Execute main function with all arguments # Execute main function with all arguments
main "$@" main "$@"