#!/bin/sh
#
# backup-script system for cloning systems using rsync
-# Copyright (c)2008-2011 Alexander Barton, alex@barton.de
+# Copyright (c)2008-2014 Alexander Barton, alex@barton.de
#
# 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
# Please read the file COPYING, README and AUTHORS for more information.
#
-MAILTO="logcheck"
+[ -n "$MAILTO" ] || MAILTO="logcheck"
NAME="backup-script"
HOST=`hostname`
-TMP="/tmp/$NAME.$$"
+TMP=`mktemp /tmp/$NAME.XXXXXXXX` || exit 11
-backup-script $* >$TMP 2>&1
+PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
+export PATH
-cat $TMP | mail -s "$HOST: $NAME results" "$MAILTO"
+echo "$NAME Report" >"$TMP"
+echo >>"$TMP"
+echo " - Host: `hostname -f`" >>"$TMP"
+echo " - User: `id -un`" >>"$TMP"
+echo >>"$TMP"
-rm -f $TMP
+`dirname "$0"`/backup-script $* >>"$TMP" 2>&1
+
+cat "$TMP" | mail -s "$HOST: $NAME results" "$MAILTO"
+
+rm -f "$TMP"
# -eof-