3 # backup-script system for cloning systems using rsync
4 # Copyright (c)2008-2015 Alexander Barton, alex@barton.de
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 # Please read the file COPYING, README and AUTHORS for more information.
13 if [ -z "$MAILTO" ]; then
14 if id "logcheck" >/dev/null 2>&1; then
16 elif fgrep "logcheck:" /etc/aliases >/dev/null 2>&1; then
25 TMP=`mktemp /tmp/$NAME.XXXXXXXX` || exit 1
26 LOGFILE="/var/log/backup-script.log"
28 PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
35 echo " - Host: `hostname -f`"
36 echo " - User: `id -un`"
39 if [ -w "$LOGFILE" ]; then
40 "$(dirname "$0")/backup-script" "$@" | tee -a "$LOGFILE"
43 "$(dirname "$0")/backup-script" "$@"
45 echo "(Can't write logfile: \"$LOGFILE\"!)"
48 cat "$TMP" | mail -s "$HOST: $NAME results" "$MAILTO"