diff --git a/backup-tar/backup.sh b/backup-tar/backup.sh index b0beb64ba619f11aeafab5a511ede1758e3abc52..f691e99fe8ba37c745125af6a2928165cc0b5d6c 100755 --- a/backup-tar/backup.sh +++ b/backup-tar/backup.sh @@ -13,11 +13,16 @@ fail() { exit 1 } -SHORT_HOST=$(hostname -s) -TARGET=backup-$SHORT_HOST@antea -SOURCES_FILE=$SCRIPT_DIR/sources_$SHORT_HOST -. $SOURCES_FILE -[[ $SOURCES ]] || fail "SOURCES expected to be set in $SOURCES_FILE" +if [[ $1 ]]; then + . $1 +else + SHORT_HOST=$(hostname -s) + TARGET=backup-$SHORT_HOST@antea + SOURCES_FILE=$SCRIPT_DIR/sources_$SHORT_HOST + . $SOURCES_FILE +fi +[[ $TARGET ]] || fail "TARGET expected to be set in config" +[[ $SOURCES ]] || fail "SOURCES expected to be set in $SOURCES_FILE or config" TIMESTAMP=$(date +"%Y-%m-%d") mkdir lock || fail "ERROR: backup already in progress (lock dir exists)"