diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | Makefile | 45 | ||||
-rwxr-xr-x | backup.in (renamed from backup) | 12 | ||||
-rw-r--r-- | hardlinkedbackups.8.in | 57 | ||||
-rwxr-xr-x | lastBackups.in (renamed from lastBackups) | 4 |
5 files changed, 115 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3ca840a --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +backup +hardlinkedbackups.8 +lastBackups diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..bc36af5 --- /dev/null +++ b/Makefile @@ -0,0 +1,45 @@ +# +# hardlinkedbackups - generates hardlinked incremental backups via rsync (and possibly through a SOCKS-tunnel via ssh) +# +# Copyright (c) 2013-2016 Erich Eckner <opensource at eckner dot net> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +# USA. +# + +DESTDIR = +ETCDIR = /etc +BINDIR = /usr/bin +MANDIR = /usr/share/man + +VERSION = 1.0.2 + +all: hardlinkedbackups.8 backup lastBackups + +%: %.in + sed "s/#VERSION#/$(VERSION)/; s@#BINDIR#@$(BINDIR)@; s@#ETCDIR#@$(ETCDIR)@" $< > $@ + +.PHONY: install dist clean + +install: all + install -D -m0755 -t $(DESTDIR)$(BINDIR) backup lastBackups + install -D -m0644 -t $(DESTDIR)$(MANDIR)/man8 hardlinkedbackups.8 + ln -S $(DESTDIR)$(MANDIR)/man8/{hardlinkedbackups,backups,lastBackups}.8 + install -D -m0644 -t $(DESTDIR)$(ETCDIR)/backup.conf + +clean: + rm -f backup lastBackups hardlinkedbackups.8 + +# End of file @@ -1,13 +1,15 @@ #!/bin/bash -. /etc/backup.conf +. #ETCDIR#/backup.conf usage() { - echo 'usage:' - echo ' backup /tmp/pidFile /path/to/destination/ user@source:path' - echo ' backup /tmp/pidFile /path/to/destination/ user@source:path proxy_user@ssh_host' - echo 'or as a symlink (e.g. in /etc/cron/daily) named after a key of $backups in /etc/backup.conf without arguments' + >&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 } diff --git a/hardlinkedbackups.8.in b/hardlinkedbackups.8.in new file mode 100644 index 0000000..c634fd9 --- /dev/null +++ b/hardlinkedbackups.8.in @@ -0,0 +1,57 @@ +.TH hardlinkedbackups 8 "" "hardlinkedbackups #VERSION#" "" +.SH NAME +hardlinkedbackups \- hardlinked incremental backups via rsync (and possibly through a SOCKS\-tunnel via ssh) +.SH SYNOPSIS +.TP +\fBbackup /tmp/pidFile /path/to/destination/ user@source:path [proxy_user@ssh_host]\fP +.TP +\fBlastBackups\fP +.SH DESCRIPTION +\fBbackup\fP generates incremental backups (by hardlinking old unchanged files) via rsync and possibly a SOCKS\-tunnel. +\fBlastBackups\fP shows date of backups and warns about outdated ones. +.SH USAGE +.TP +.B "backup /tmp/pidFile /path/to/destination/ user@source:path" +Creates incremental backup in \fB/path/to/destination/\fP from \fBuser@source:path\fP, saving its PID in \fB/tmp/pidFile\fP. +.TP +.B "backup /tmp/pidFile /path/to/destination/ user@source:path proxy_user@ssh_host" +Same as above, but tunneling via SSH through \fBproxy_user@ssh_host\fP. +.TP +.B "symLinkName -> #BINDIR#/backup" +Same as one of the above. +Command line parameters are filled from variable \fB$backups["symLinkName"]\fP in \fB#ETCDIR#/backup.conf\fP. +This is designed to be called from a cron daemon for daily backups. +.TP +.B "lastBackups" +reports about actuality of backups defined in \fB#ETCDIR#/backup.conf\fP +.SH CONFIGURATION +The configfile \fB#ETCDIR/backup.conf\fP is a bash script, which defines the following variables: +.TP +.B "excludes" +array of paths to exclude from backup +.TP +.B "backups" +array with command line arguments for predefined backups +.TP +.B "maxWait" +maximum time to wait for destination directories to appear in lastBackups [seconds] +.TP +.B "outdatedLimit" +time before backups are considered outdated [seconds] +.TP +.B "recognSubdirRegex" +regular expression of subdirectories which should be appended to the parent directory in the report +.SH FILES +.TP +.B "#BINDIR#/backup" +program for creation of backups +.TP +.B "#BINDIR#/lastBackups" +program for check of backups +.TP +.B "#ETCDIR#/backup.conf" +configuration of backups +.SH AUTHOR +.nf +Erich Eckner <opensource at eckner dot net> +.fi diff --git a/lastBackups b/lastBackups.in index 83fcbed..ea6040a 100755 --- a/lastBackups +++ b/lastBackups.in @@ -1,6 +1,8 @@ #!/bin/bash -. /etc/backup.conf +# lastBackups version #VERSION# + +. #ETCDIR#/backup.conf unset namen unset veraltet |