› Forums › Network Management › Signal a BUG › [FIXED] the (monitoring) message spooler not sending emails › Re: Yes there is a bug in the spooler – Fix provided
The spooler is made of the script spoolerd and it is not running because actually it aborts when I try to run it manually.
The previously queued file was named:
1_1508439602_Emergency_b031d51f_DISKFULL
…and the email was properly sent
Another one is named:
7_949653234_Info_18c8f180_STARTED
…and causes this error:
./spoolerd: line 28: 949653234_: value too great for base (error token is “949653234_”)
MESSAGES="`ls -d * 2>/dev/null`"
for M in $MESSAGES ; do
TS="${M:2:10}"
SEVERITY="`echo $M | awk -F_ '{print $3}'`"
SUBJECT="`cat $M/Subject 2>/dev/null`"
TYPE="`cat $M/Type 2>/dev/null`"
MRECIPIENT="`cat $M/Recipient 2>/dev/null`"
if [ "$TYPE" = Recipient ] ; then
TYPE="`cat $CONFIG/Recipients/$MRECIPIENT/Type`"
fi
ID="`echo $M | awk -F_ '{print $4}'`"
EVENT="`echo $M | awk -F_ '{print $5}'`"
NOW=`date +%s`
if [ $((NOW-TS)) -gt $MAXAGE ] ; then <
$SCRIPTS/alerts_logger "$ID" "$EVENT ($SEVERITY): message expired."
I guess that this is a timestamp assumed to use 10 digits then at early hours it is shorter, unless a change is done to left pad it with a zero.
But if doing so, the test must force base10 to avoid another surprise with octal faults at 8 and 9 o’clock:
if [ $(( $NOW – 10#$TS )) -gt $MAXAGE ] ; then
Actually in this case it can be fixed a simplier way by just removing the potential trailing underscore:
MESSAGES="`ls -d * 2>/dev/null`"
for M in $MESSAGES ; do
TS="${M:2:10}"
TS="${TS%%_}" <
SEVERITY="`echo $M | awk -F_ '{print $3}'`"
...
Until this is integrated, it is necessary to replace spoolerd with a fixed copy in the PostBoot script, then run alerts_start again because it has already crashed.
But this fixes the issue, ps -A shows the spoolerd running and the emails are sent. 8)
Hope it helps, Best regards.