[Gllug] Arithmetic error in bash on 08 and 09?
Liam Delahunty
liamvictor at gmail.com
Wed Jul 21 14:28:05 UTC 2004
I've got a little script running as an hourly cron job. (Basically
I've found that Mailscanenr starts to have problems in the wee hours
and stop/start helps).
#!/bin/sh
previoushour=`date "+%H"`
previoushour=$((previoushour-1))
today=`date "+%b %d"`
then=$today" "$previoushour
killed=`grep "$then" /var/log/maillog | grep 'SpamAssassin timed out
and was killed'|wc -l`
if [ "$killed" -ge "1" ]; then
echo "$then SpamAssassin timed out and was killed $killed"
grep "$then" /var/log/maillog | grep 'SpamAssassin timed out and was killed'
/etc/rc.d/init.d/MailScanner stop
sleep 4
/etc/rc.d/init.d/MailScanner status
sleep 4
echo "restart MailScanner"
/etc/rc.d/init.d/MailScanner start
/etc/rc.d/init.d/MailScanner status
fi
But I get errors at both 8 am and 9 am, presumably because of the arithmetic.
Here's the eight o'clock error.
/etc/cron.hourly/check_mailscanner_spam.sh: 08: value too great for
base (remainder of expression is "08")
Here's the nine o'clock error.
/etc/cron.hourly/check_mailscanner_spam.sh: 09: value too great for
base (remainder of expression is "09")
Why? Why not 01, 02, 03 etc... and naturally, any suggestions for
improving the script.
--
Kind regards, Liam Delahunty
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list