From: Bernie Innocenti Date: Fri, 8 Mar 2013 23:39:54 +0000 (-0500) Subject: Report errors X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=8719e5cb6026c9242473d392e6dec250fb849551;p=wizbackup.git Report errors --- diff --git a/wizbackup-driver b/wizbackup-driver index e85d41f..957571c 100755 --- a/wizbackup-driver +++ b/wizbackup-driver @@ -40,8 +40,12 @@ mkdir -p $LOCKDIR if [ "`tty`" = "not a tty" ]; then LOGFILE="$LOGDIR/$LOGGROUP-$today.log" + FAILLOG="$LOGDIR/$LOGGROUP-fail-$today.log" + REPORT="$LOGDIR/$LOGGROUP-report-$today.log" else LOGFILE=/dev/stdout + FAILLOG=/dev/stderr + REPORT=/dev/stdout fi for host in $HOSTS; do @@ -57,9 +61,13 @@ for host in $HOSTS; do end_time=$(date +%s) report="$(date +%s):$host:$(($end_time-$start_time)):$result" - echo $report >>$LOGDIR/$LOGGROUP-report-$today.log - [ $result != 0 ] && echo "$report" >>$LOGDIR/$LOGGROUP-fail-$today.log + echo $report >>"$REPORT" + [ $result != 0 ] && echo "$report" >>"$FAILLOG" done -# TODO: send fail log email report -# TODO: delete logs older than 45 days +if [ -s "$FAILLOG" ]; then + cat "$FAILLOG" + exit 1 +fi + +# TODO: delete logs older than N days