diff --git a/scripts/imports/backup_all.sh b/scripts/imports/backup_all.sh index 2717e0b..c016517 100644 --- a/scripts/imports/backup_all.sh +++ b/scripts/imports/backup_all.sh @@ -2,8 +2,13 @@ # Enable error handling set -e -trap 'echo "[$(date +'%Y-%m-%d %H:%M:%S')] Backup failed" >> "$LOG_DIR/backup_error.log"' ERR +# Define log file path +LOG_DIR="/home/jelastic/mb-backups/logs" +mkdir -p "$LOG_DIR" + +# Properly escape the trap command +trap 'echo "[$(date +'\''%Y-%m-%d %H:%M:%S'\'')] Backup failed" >> "$LOG_DIR/backup_error.log"' ERR # Load the backup logic functions source /home/jelastic/mb-backups/backup-logic.sh @@ -12,7 +17,6 @@ password_file="/etc/restic-password" APP_PATH='/var/www/webroot/ROOT' WP_CONFIG="${APP_PATH}/wp-config.php" backupPath='/mnt/backups' -LOG_DIR="/home/jelastic/mb-backups/logs" TEMP_DIR="/tmp/wp_backup_tmp" MAX_BACKUP_SIZE=$((10 * 1024 * 1024 * 1024)) # 10GB