diff --git a/conf/backup_method b/conf/backup_method index 29a3980..a8d41cc 100644 --- a/conf/backup_method +++ b/conf/backup_method @@ -46,7 +46,20 @@ This is an automated message from your beloved YunoHost server." | /usr/bin/mail # About the {now} placeholder: # https://borgbackup.readthedocs.io/en/stable/usage/create.html#description # In the archive name, you may use the following placeholders: {now}, {utcnow}, {fqdn}, {hostname}, {user} and some others. - "$borg" create --stats "::${name}-{now}" "$work_dir" + "$borg" create --stats "::${name}-{now}" "$work_dir" || status=$? + # Check whether the above command exit with a return code > 0 + case "$status" in + "") # return code was 0, skip + ;; + "1") + # This is a warning, the script may continue, but let's warn the admin. + # See: https://github.com/borgbackup/borg/issues/6989#issuecomment-1223921392 + echo "Some warning were logged during the backup, you'd probably check whether it was severe or not" >&2 + ;; + *) + exit $status + ;; + esac "$borg" prune --glob-archives "${name}-*" --list --keep-hourly 2 --keep-daily=7 --keep-weekly=8 --keep-monthly=12