Skip to content
Snippets Groups Projects
Commit 343ff05d authored by Vladimír Štill's avatar Vladimír Štill
Browse files

backup-tar: Make standalone config file possible

parent d7e1025a
No related branches found
No related tags found
No related merge requests found
...@@ -13,11 +13,16 @@ fail() { ...@@ -13,11 +13,16 @@ fail() {
exit 1 exit 1
} }
SHORT_HOST=$(hostname -s) if [[ $1 ]]; then
TARGET=backup-$SHORT_HOST@antea . $1
SOURCES_FILE=$SCRIPT_DIR/sources_$SHORT_HOST else
. $SOURCES_FILE SHORT_HOST=$(hostname -s)
[[ $SOURCES ]] || fail "SOURCES expected to be set in $SOURCES_FILE" 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") TIMESTAMP=$(date +"%Y-%m-%d")
mkdir lock || fail "ERROR: backup already in progress (lock dir exists)" mkdir lock || fail "ERROR: backup already in progress (lock dir exists)"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment