plugin rsnapshot_duration: avoid "broken pipe" errors from tac
Consume the complete input from "tac". Otherwise spammy error messages would appear in the log.
This commit is contained in:
parent
818886ba36
commit
d31406451a
|
@ -78,9 +78,9 @@ RSNAPSHOT_DESCRIPTION=${rsnapshot_description:-Backup Duration}
|
||||||
get_latest_process_log() {
|
get_latest_process_log() {
|
||||||
tac "$LOG_FILE" \
|
tac "$LOG_FILE" \
|
||||||
| awk '
|
| awk '
|
||||||
BEGIN { in_process = 0; }
|
BEGIN { in_process = 0; is_finished = 0; }
|
||||||
/ '"$RSNAPSHOT_OPERATION_NAME"': completed[, ]/ { in_process = 1; }
|
/ '"$RSNAPSHOT_OPERATION_NAME"': completed[, ]/ { if (is_finished == 0) in_process = 1; }
|
||||||
/ '"$RSNAPSHOT_OPERATION_NAME"': started$/ { if (in_process == 1) exit; }
|
/ '"$RSNAPSHOT_OPERATION_NAME"': started$/ { if (in_process == 1) { in_process = 0; is_finished = 1; }}
|
||||||
{ if (in_process == 1) print($0); }' \
|
{ if (in_process == 1) print($0); }' \
|
||||||
| tac
|
| tac
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ get_backups_with_duration() {
|
||||||
if [ -n "${backup_name:-}" ]; then
|
if [ -n "${backup_name:-}" ]; then
|
||||||
printf '%s\t%d\t%s\n' "$backup_name" "$((parsed_timestamp - backup_start))" "${backup_errors:-}"
|
printf '%s\t%d\t%s\n' "$backup_name" "$((parsed_timestamp - backup_start))" "${backup_errors:-}"
|
||||||
fi
|
fi
|
||||||
break
|
cat >/dev/null
|
||||||
fi
|
fi
|
||||||
done | sort
|
done | sort
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue