summaryrefslogtreecommitdiff
path: root/backup.in
diff options
context:
space:
mode:
Diffstat (limited to 'backup.in')
-rwxr-xr-xbackup.in36
1 files changed, 28 insertions, 8 deletions
diff --git a/backup.in b/backup.in
index 0a61933..33a59f3 100755
--- a/backup.in
+++ b/backup.in
@@ -1,18 +1,38 @@
#!/bin/bash
-. #ETCDIR#/backup.conf
+[ -r "#ETCDIR#/backup.conf" ] && \
+ . "#ETCDIR#/backup.conf"
usage()
{
- >&2 echo 'This is backup version #VERSION#'
- >&2 echo ''
- >&2 echo 'usage:'
- >&2 echo ' backup /tmp/pidFile /path/to/destination/ user@source:path'
- >&2 echo ' backup /tmp/pidFile /path/to/destination/ user@source:path proxy_user@ssh_host'
- >&2 echo 'or as a symlink (e.g. in /etc/cron/daily) named after a key of $backups in #ETCDIR#/backup.conf without arguments'
- exit 1
+ >&2 echo \
+'Usage: backup /tmp/pidFile /path/to/destination/ user@source:path [proxy_user@ssh_host]
+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.
+
+Options:
+ /tmp/pidFile location of file to store PID in
+ /path/to/destination location to store backups in
+ user@source:path remote data to back up
+ proxy_user@ssh_host ssh login to proxy node (optional)
+#HELPTEXT# #'
+ [ -z "$1" ] && exit 1
+ exit $1
}
+if [ $# -eq 1 ]
+then
+ if [ "$1" == "--help" ]
+ then
+ usage 0
+ elif [ "$1" == "--version" ]
+ then
+ echo '#VERSION#'
+ exit
+ fi
+fi
+
if [ $# -eq 0 ]
then
backupID="$(basename $0)"