Compare commits

...
Author SHA1 Message Date
MickLesk 8d870e5675 Report an interrupted update-apps backup as cancelled, not failed
vzdump answers Ctrl+C, or a stop from the task list, with "interrupted
by signal", and update-apps reported that as "Backup failed" (exit 235).
On a test host Ctrl+C during the backup gives exactly the message seen
in eight of the 33 backup failures of the last four days; closing the
console does not stop the backup. Report it as interrupted with exit
130 instead.

A rejected vzdump option ends its output with the usage line, so the
reason read "vzdump {<vmid>} [OPTIONS]". Skip that line so the option's
own error is shown.
2026-11-20 17:25:32 +01:00
+7 -1
View File
@@ -275,7 +275,8 @@ function dry_run_container() {
function failure_reason() {
local reason
reason=$(grep -m1 '^ERROR:' <<<"$1" | sed 's/^ERROR: //')
[[ -n "$reason" ]] || reason=$(grep -v '^[[:space:]]*$' <<<"$1" | tail -n1)
# A rejected option ends in the usage line, the option's error is above it.
[[ -n "$reason" ]] || reason=$(grep -v -e '^[[:space:]]*$' -e '\[OPTIONS\]$' <<<"$1" | tail -n1)
printf '%s' "$reason"
}
@@ -286,6 +287,11 @@ function backup_container() {
msg_ok "Backup created"
else
log_write "Container $1: vzdump failed:"$'\n'"$output"
# Ctrl+C, or the task was stopped: the backup did not fail, it was cancelled.
if grep -q "interrupted by signal" <<<"$output"; then
msg_error "Backup of container $1 was interrupted (Ctrl+C or the task was stopped)"
exit 130
fi
msg_error "Backup failed for container $1: $(failure_reason "$output")"
exit 235
fi