summaryrefslogtreecommitdiff
path: root/backup.in
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2016-10-11 13:32:46 +0200
committerErich Eckner <git@eckner.net>2016-10-11 14:24:11 +0200
commit903564349edb8e2ef457a5dbf09d3ed9c9c206f5 (patch)
treeef7a476c37e967d4df02ed21d5b38d4c9944d09e /backup.in
parent42b083a197c3d29cce74c22606e16317f18f808b (diff)
downloadhardlinkedBackups-903564349edb8e2ef457a5dbf09d3ed9c9c206f5.tar.xz
alle manpages sollten jetzt funktionieren
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)"