From f5a6131b37db54d518651c7af564d03690a0d281 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 2 Jan 2019 21:06:29 +0100 Subject: backup.in: exactly one parameter is acceptable, too --- backup.in | 9 +++++++-- 1 file 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[@]}" | \ -- cgit v1.2.3