From e98192a7f819daa06b50ef681183ab51d04a440f Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Tue, 18 Aug 2015 09:58:13 +0200 Subject: [PATCH] backup-script-wrapper: Use "exec" to redirect output --- bin/backup-script-wrapper | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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" -- 2.39.2