Timestamp error messages; log fatal errors

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@7734 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep
2007-11-23 22:15:22 +00:00
parent 1a234e49fa
commit 9d5e2f7941
2 changed files with 36 additions and 2 deletions

View File

@@ -49,6 +49,12 @@ clear_firewall() {
fatal_error()
{
echo " ERROR: $@" >&2
if [ $LOG_VERBOSE -gt 1 ]; then
timestamp="$(date +'%_b %d %T') "
echo "${timestamp} ERROR: $@" >> $STARTUP_LOG
fi
stop_firewall
[ -n "$TEMPFILE" ] && rm -f $TEMPFILE
exit 2
@@ -72,6 +78,22 @@ startup_error() # $* = Error Message
;;
esac
if [ $LOG_VERBOSE -gt 1 ]; then
timestamp="$(date +'%_b %d %T') "
case $COMMAND in
start)
echo "${timestamp} ERROR:$PRODUCT start failed" >> $STARTUP_LOG
;;
restart)
echo "${timestamp} ERROR:$PRODUCT restart failed" >> $STARTUP_LOG
;;
restore)
echo "${timestamp} ERROR:$PRODUCT restore failed" >> $STARTUP_LOG
;;
esac
fi
kill $$
exit 2
}