Commit Diff


commit - a4b92899244d2dc8181f1c391d7cacf90691fece
commit + c27b8fc3f1935d69c66560ecad3b5225ed8de9d4
blob - 6ff5e1e8bf827ee418b1116d468f6de1187a9dab
blob + f79ab6c5122fc2847e6770f7a83afea70874d2fc
--- restic-backup.sh
+++ restic-backup.sh
@@ -1,13 +1,18 @@
 #!/bin/sh -eu
 
-exec >> /var/log/backup.log 2>&1
-date
-
 # backup home directory to external server using restic.
 # steps:
 #   1. backup
 #   2. keep last x snapshots
 
+if [ $# -ne 1 ]; then
+	printf "Usage: $(basename $0) CONFIG_PATH\n" >&2
+	exit 1
+fi
+
+exec >> /var/log/backup.log 2>&1
+date
+
 printf "Using configuration file \"$1\"\n"
 # TODO: env var expanding in dot is not posix
 # https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#dot