Fix trap error
parent
1642074673
commit
716fcce79c
|
@ -2,8 +2,13 @@
|
||||||
|
|
||||||
# Enable error handling
|
# Enable error handling
|
||||||
set -e
|
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
|
# Load the backup logic functions
|
||||||
source /home/jelastic/mb-backups/backup-logic.sh
|
source /home/jelastic/mb-backups/backup-logic.sh
|
||||||
|
|
||||||
|
@ -12,7 +17,6 @@ password_file="/etc/restic-password"
|
||||||
APP_PATH='/var/www/webroot/ROOT'
|
APP_PATH='/var/www/webroot/ROOT'
|
||||||
WP_CONFIG="${APP_PATH}/wp-config.php"
|
WP_CONFIG="${APP_PATH}/wp-config.php"
|
||||||
backupPath='/mnt/backups'
|
backupPath='/mnt/backups'
|
||||||
LOG_DIR="/home/jelastic/mb-backups/logs"
|
|
||||||
TEMP_DIR="/tmp/wp_backup_tmp"
|
TEMP_DIR="/tmp/wp_backup_tmp"
|
||||||
MAX_BACKUP_SIZE=$((10 * 1024 * 1024 * 1024)) # 10GB
|
MAX_BACKUP_SIZE=$((10 * 1024 * 1024 * 1024)) # 10GB
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue