Fix JPS errors
parent
301d5dceda
commit
12226390a7
35
manifest.jps
35
manifest.jps
|
@ -1,5 +1,5 @@
|
||||||
type: update
|
type: update
|
||||||
jpsVersion: 1.1
|
jpsVersion: 1.2
|
||||||
name: MightyBox WordPress Backup/Restore Addon
|
name: MightyBox WordPress Backup/Restore Addon
|
||||||
id: mb-backup-manager
|
id: mb-backup-manager
|
||||||
description: Custom Backup and Restore Addon for WordPress using Restic. Supports backing up databases, core files, media files, and full backups with scheduling and retention policies.
|
description: Custom Backup and Restore Addon for WordPress using Restic. Supports backing up databases, core files, media files, and full backups with scheduling and retention policies.
|
||||||
|
@ -181,22 +181,23 @@ onAfterClone:
|
||||||
|
|
||||||
actions:
|
actions:
|
||||||
configureAutoBackup:
|
configureAutoBackup:
|
||||||
- cmd[cp]:
|
- cmd[cp]:
|
||||||
user: root
|
user: root
|
||||||
commands: |
|
commands: |
|
||||||
if [ ! -f /etc/restic-password ]; then
|
if [ ! -f /etc/restic-password ]; then
|
||||||
echo "Error: Restic password file not found"
|
echo "Error: Restic password file not found"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
RESTIC_PWD=$(cat /etc/restic-password)
|
RESTIC_PWD=$(cat /etc/restic-password)
|
||||||
if [ "${settings.frequency}" = "daily" ]; then
|
if [ "${settings.frequency}" = "daily" ]; then
|
||||||
bash ${globals.scriptPath}/manage_backup_schedule.sh add "0 ${settings.hour} * * *" "$RESTIC_PWD"
|
cron_schedule="0 ${settings.hour} * * *"
|
||||||
else
|
else
|
||||||
bash ${globals.scriptPath}/manage_backup_schedule.sh add "0 ${settings.hour} * * ${settings.dayOfWeek}" "$RESTIC_PWD"
|
cron_schedule="0 ${settings.hour} * * ${settings.dayOfWeek}"
|
||||||
fi
|
fi
|
||||||
- return:
|
bash ${globals.scriptPath}/manage_backup_schedule.sh add "$cron_schedule" "$RESTIC_PWD"
|
||||||
type: info
|
- return:
|
||||||
message: "${response.out}"
|
type: info
|
||||||
|
message: "${response.out}"
|
||||||
|
|
||||||
removeAutoBackup:
|
removeAutoBackup:
|
||||||
- cmd[cp]:
|
- cmd[cp]:
|
||||||
|
|
|
@ -101,21 +101,21 @@ add_update_cron_job() {
|
||||||
local schedule="$2"
|
local schedule="$2"
|
||||||
local restic_password="$3"
|
local restic_password="$3"
|
||||||
local temp_crontab="/tmp/temp_crontab.$$"
|
local temp_crontab="/tmp/temp_crontab.$$"
|
||||||
|
|
||||||
# Validate inputs
|
# Validate inputs
|
||||||
if ! validate_schedule "$schedule"; then
|
if ! validate_schedule "$schedule"; then
|
||||||
return 1
|
return 1
|
||||||
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\" \
|
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\""
|
$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
|
||||||
echo "$schedule $CMD" >> "$temp_crontab"
|
echo "$schedule $CMD" >> "$temp_crontab"
|
||||||
|
|
||||||
if crontab "$temp_crontab"; then
|
if crontab "$temp_crontab"; then
|
||||||
log_action "Successfully ${action}d backup schedule: $schedule"
|
log_action "Successfully ${action}d backup schedule: $schedule"
|
||||||
rm -f "$temp_crontab"
|
rm -f "$temp_crontab"
|
||||||
|
|
Loading…
Reference in New Issue