fix prune check
This commit is contained in:
10
backup.sh
10
backup.sh
@ -439,7 +439,10 @@ main() {
|
|||||||
# Run the prune
|
# Run the prune
|
||||||
local prune_output
|
local prune_output
|
||||||
if ! prune_output=$(restic -r "${CONFIG[RESTIC_REPOSITORY]}" forget --keep-last "${CONFIG[KEEP_LAST]}" --group-by "" --prune 2>&1); then
|
if ! prune_output=$(restic -r "${CONFIG[RESTIC_REPOSITORY]}" forget --keep-last "${CONFIG[KEEP_LAST]}" --group-by "" --prune 2>&1); then
|
||||||
log "Prune operation failed"
|
log "Prune operation failed with output:"
|
||||||
|
echo "$prune_output" | while read -r line; do
|
||||||
|
log " $line"
|
||||||
|
done
|
||||||
status="⚠️ Backup OK, Prune Failed"
|
status="⚠️ Backup OK, Prune Failed"
|
||||||
color="${DISCORD_COLORS[warning]}"
|
color="${DISCORD_COLORS[warning]}"
|
||||||
prune_status="Prune operation failed"
|
prune_status="Prune operation failed"
|
||||||
@ -448,9 +451,12 @@ main() {
|
|||||||
if echo "$prune_output" | grep -q "no snapshots were removed"; then
|
if echo "$prune_output" | grep -q "no snapshots were removed"; then
|
||||||
log "No snapshots to prune"
|
log "No snapshots to prune"
|
||||||
prune_status="No snapshots to prune"
|
prune_status="No snapshots to prune"
|
||||||
else
|
elif echo "$prune_output" | grep -q "removed"; then
|
||||||
log "Successfully pruned old backups"
|
log "Successfully pruned old backups"
|
||||||
prune_status="Successfully pruned old backups"
|
prune_status="Successfully pruned old backups"
|
||||||
|
else
|
||||||
|
log "Prune completed but no clear status found in output"
|
||||||
|
prune_status="Prune completed"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user