using new --compact option for snapshot monitoring, returning error when restic command fails

This commit is contained in:
Alexander Rust 2017-09-18 10:41:05 +02:00
parent 3dd69be90c
commit d271c0be93

View file

@ -86,8 +86,9 @@ do_monitor () {
CRIT=$5 CRIT=$5
# Get last line and parse into variables. Removes header and is empty when no snapshot exists for host # Get last line and parse into variables. Removes header and is empty when no snapshot exists for host
LAST=`$RESTIC snapshots --no-lock -H $3 | sed 1,2d | tail -n 1` LAST=`$RESTIC snapshots --compact --no-lock -H $3 | sed 1,2d | tail -n 1`
if [ ! $? -eq 0 ]; then if [ ! $? -eq 0 ]; then
echo "WARNING - restic command returned an error"
exit 1; exit 1;
fi fi