]> arthur.barton.de Git - backup-script.git/blobdiff - bin/backup-script-wrapper
backup-script-wrapper: Use bash
[backup-script.git] / bin / backup-script-wrapper
index 8ae3fc800e695461ac587366c3a3acea327cd5b8..f877a5b912b7c5c882c1ddd50e109717d6c9b840 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # backup-script system for cloning systems using rsync
 # Copyright (c)2008-2015 Alexander Barton, alex@barton.de
@@ -23,6 +23,7 @@ fi
 NAME="backup-script"
 HOST=`hostname`
 TMP=`mktemp /tmp/$NAME.XXXXXXXX` || exit 11
+LOGFILE="/var/log/backup-script.log"
 
 PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
 export PATH
@@ -35,7 +36,12 @@ echo " - Host: `hostname -f`"
 echo " - User: `id -un`"
 echo
 
-"$(dirname "$0")/backup-script" "$@"
+if [ -w "$LOGFILE" ]; then
+       "$(dirname "$0")/backup-script" "$@" | tee -a "$LOGFILE"
+else
+       "$(dirname "$0")/backup-script" "$@"
+       echo "(Can't write logfile: \"$LOGFILE\"!)"
+fi
 
 cat "$TMP" | mail -s "$HOST: $NAME results" "$MAILTO"