From: Alexander Barton Date: Tue, 18 Aug 2015 07:58:13 +0000 (+0200) Subject: backup-script-wrapper: Use "exec" to redirect output X-Git-Url: https://arthur.barton.de/gitweb/?p=backup-script.git;a=commitdiff_plain;h=e98192a7f819daa06b50ef681183ab51d04a440f;hp=6f11b5a6e921e119cacb84158382c928874925c9 backup-script-wrapper: Use "exec" to redirect output --- diff --git a/bin/backup-script-wrapper b/bin/backup-script-wrapper index 282cab0..8ae3fc8 100755 --- a/bin/backup-script-wrapper +++ b/bin/backup-script-wrapper @@ -27,13 +27,15 @@ TMP=`mktemp /tmp/$NAME.XXXXXXXX` || exit 11 PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin" export PATH -echo "$NAME Report" >"$TMP" -echo >>"$TMP" -echo " - Host: `hostname -f`" >>"$TMP" -echo " - User: `id -un`" >>"$TMP" -echo >>"$TMP" +exec >"$TMP" 2>&1 -"$(dirname "$0")/backup-script" "$@" >>"$TMP" 2>&1 +echo "$NAME Report" +echo +echo " - Host: `hostname -f`" +echo " - User: `id -un`" +echo + +"$(dirname "$0")/backup-script" "$@" cat "$TMP" | mail -s "$HOST: $NAME results" "$MAILTO"