diff options
author | Erich Eckner <git@eckner.net> | 2019-01-02 21:06:29 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-01-02 21:06:29 +0100 |
commit | f5a6131b37db54d518651c7af564d03690a0d281 (patch) | |
tree | dcacb973221776ecd3b16f4dcbd55cac5d227379 | |
parent | a812c1b07c7de16f3bb4d08ed697b36b701f05b9 (diff) | |
download | hardlinkedBackups-f5a6131b37db54d518651c7af564d03690a0d281.tar.xz |
backup.in: exactly one parameter is acceptable, too
-rwxr-xr-x | backup.in | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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[@]}" | \ |