projects
/
wizbackup.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bfa332b
)
Report errors
author
Bernie Innocenti
<bernie@codewiz.org>
Fri, 8 Mar 2013 23:39:54 +0000
(18:39 -0500)
committer
Bernie Innocenti
<bernie@codewiz.org>
Fri, 8 Mar 2013 23:39:54 +0000
(18:39 -0500)
wizbackup-driver
patch
|
blob
|
history
diff --git
a/wizbackup-driver
b/wizbackup-driver
index e85d41f2f81f3b3b26569d0dee58b71f0ddf03f1..957571cb757ed9f3a2857ffd5677b75dcb54bfa7 100755
(executable)
--- a/
wizbackup-driver
+++ b/
wizbackup-driver
@@
-40,8
+40,12
@@
mkdir -p $LOCKDIR
if [ "`tty`" = "not a tty" ]; then
LOGFILE="$LOGDIR/$LOGGROUP-$today.log"
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
else
LOGFILE=/dev/stdout
+ FAILLOG=/dev/stderr
+ REPORT=/dev/stdout
fi
for host in $HOSTS; do
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"
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
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