]> arthur.barton.de Git - backup-script.git/blobdiff - bin/backup-script-wrapper
backup-script-wrapper: Sort variables alphabetically
[backup-script.git] / bin / backup-script-wrapper
index 482609fa0ea65b6b58722818ccb063c6eb0810d1..bb9009de65a9b9132ad5921cb6d9f71c6869b233 100755 (executable)
@@ -21,10 +21,12 @@ if [ -z "$MAILTO" ]; then
 fi
 
 NAME="backup-script"
+
+DELIMITER="- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
 HOST=`hostname -f`
+LOGFILE="/var/log/$NAME.log"
+SUBJECT="$NAME results"
 TMP=`mktemp /tmp/$NAME.XXXXXXXX` || exit 1
-LOGFILE="/var/log/backup-script.log"
-DELIMITER="- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
 
 PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
 export PATH
@@ -47,7 +49,14 @@ else
        echo "(Can't write logfile: \"$LOGFILE\"!)"
 fi
 
-cat "$TMP" | mail -s "$HOST: $NAME results" "$MAILTO"
+case "$r" in
+       0)
+               ;;
+       *)
+               SUBJECT="$SUBJECT - with ERRORS!"
+esac
+
+cat "$TMP" | mail -s "$HOST: $SUBJECT" "$MAILTO"
 
 rm -f "$TMP"
 exit $r