From 06296f39e1183a6423a8adb7d520ea8d81500244 Mon Sep 17 00:00:00 2001 From: Felix Bartels Date: Fri, 14 Sep 2018 16:48:39 +0200 Subject: [PATCH] define an empty default if RESTIC_ARGS is not set since backup is running with `set -uo pipefail` unset variables are not allowed. Signed-off-by: Felix Bartels --- bin/backup | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/backup b/bin/backup index 7f1aeb2..5010226 100755 --- a/bin/backup +++ b/bin/backup @@ -42,6 +42,8 @@ handle_params () { do_monitor $@ else shift 1 + # define an empty default if RESTIC_ARGS is not set + RESTIC_ARGS=${RESTIC_ARGS:-""} $RESTIC $RESTIC_ARGS $@ fi } @@ -83,6 +85,8 @@ do_monitor () { WARN=$4 CRIT=$5 + # define an empty default if RESTIC_ARGS is not set + RESTIC_ARGS=${RESTIC_ARGS:-""} SNAPS=`$RESTIC $RESTIC_ARGS snapshots --compact --no-lock -H $3` # Get last line and parse into variables. Removes header and is empty when no snapshot exists for host LAST=`sed 1,2d <<< $SNAPS | head -n -2 | tail -n 1`