3 # backup-script system for cloning systems using rsync
4 # Copyright (c)2008-2016 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 grep -F "logcheck:" /etc/aliases >/dev/null 2>&1; then
25 DELIMITER="- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
27 LOGFILE="/var/log/$NAME.log"
28 SUBJECT="$NAME results"
29 TMP=$(mktemp /tmp/$NAME.XXXXXXXX) || exit 1
31 PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
38 echo " - Host: $(hostname -f)"
39 echo " - User: $(id -un)"
45 if echo "$DELIMITER" >>"$LOGFILE" 2>/dev/null; then
47 "$(dirname "$0")/backup-script" "$@" | tee -a "$LOGFILE"
50 "$(dirname "$0")/backup-script" "$@"
52 echo "(Can't write logfile: \"$LOGFILE\"!)"
57 SUBJECT="$SUBJECT - success"
60 SUBJECT="$SUBJECT - with ERRORS!"
63 mail -s "$HOST: $SUBJECT" "$MAILTO" <"$TMP"