summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-01-02 21:06:29 +0100
committerErich Eckner <git@eckner.net>2019-01-02 21:06:29 +0100
commitf5a6131b37db54d518651c7af564d03690a0d281 (patch)
treedcacb973221776ecd3b16f4dcbd55cac5d227379
parenta812c1b07c7de16f3bb4d08ed697b36b701f05b9 (diff)
downloadhardlinkedBackups-f5a6131b37db54d518651c7af564d03690a0d281.tar.xz
backup.in: exactly one parameter is acceptable, too
-rwxr-xr-xbackup.in9
1 files changed, 7 insertions, 2 deletions
diff --git a/backup.in b/backup.in
index 6723699..bfe3e61 100755
--- a/backup.in
+++ b/backup.in
@@ -15,6 +15,7 @@ usage()
Backup files from remote with rsync, possibly via SSH-tunnel.
With no arguments, information is expected to be in array $backups in #ETCDIR#/backup.conf with name of executable (e.g. a symlink) as key.
+With one argument, information is expected to be in array ${backups[$1]} in #ETCDIR#/backup.conf.
Options:
/tmp/pidFile location of file to store PID in
@@ -36,8 +37,12 @@ if [ $# -eq 1 ]; then
fi
seldom=false
-if [ $# -eq 0 ]; then
- backupID="$(basename $0)"
+if [ $# -eq 0 ] || [ $# -eq 1 ]; then
+ if [ $# -eq 0 ]; then
+ backupID="$(basename $0)"
+ else
+ backupID="$1"
+ fi
[ -z "${backups[${backupID}]}" ] && usage
set /tmp/${backupID}.pid ${backups[${backupID}]}
if printf '%s\n' "${seldomBackups[@]}" | \