1

Topic: Cron Daily and Spamassassin Failure

==== Required information ====
- iRedMail version: 0.9.2
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Apache
- Linux/BSD distribution name and version: Debian 8.1
- Related log if you're reporting an issue: Anacron
===

Greetings everyone! For the last couple of days, I've been getting Anacron notices from root at my server, each morning, telling me the following:

/etc/cron.daily/spamassassin:
Job for spamassassin.service failed. See 'systemctl status spamassassin.service' and 'journalctl -xn' for details.
invoke-rc.d: initscript spamassassin, action "reload" failed.

when I do a "systemctl status spamassassin.service -l" I get the following:

Jun 15 07:37:12 mail systemd[1]: Unit spamassassin.service cannot be reloaded because it is inactive.
Jun 16 08:12:14 mail systemd[1]: Unit spamassassin.service cannot be reloaded because it is inactive.

journalctl -xn doesn't yield much information, either. I understand that spamassassin isn't really running as a service, because Amavis is doing the work by using SA in the background. The spamassassin script in /etc/cron.daily/ is as follows:

CRON=0

test -f /etc/default/spamassassin && . /etc/default/spamassassin

test -x /usr/bin/sa-update || exit 0
test -x /etc/init.d/spamassassin || exit 0

if [ "$CRON" = "0" ] ; then
    exit 0
fi

# If there's a problem with the ruleset or configs, print the output
# of spamassassin --lint (which will typically get emailed to root)
# and abort.
die_with_lint() {
    env -i LANG="$LANG" PATH="$PATH" start-stop-daemon \
        --chuid debian-spamd:debian-spamd --start \
        --exec /usr/bin/spamassassin -- -D --lint 2>&1
    exit 1
}

do_compile() {
# Compile rules if the required tools are available. Prior to version
# 3.3.2-8, there was an additional check to verify that an sa-compile
# run had previously been executed by hand. With sa-learn now
# distributed in a separate, optional, package, this check is no
# longer necessary.
    if [ -x /usr/bin/re2c -a -x /usr/bin/sa-compile ]; then
        env -i LANG="$LANG" PATH="$PATH" start-stop-daemon \
            --chuid debian-spamd:debian-spamd --start \
            --exec /usr/bin/sa-compile -- --quiet

        # Fixup perms -- group and other should be able to
        # read and execute, but never write.  Works around
        # sa-compile's failure to obey umask.
        chmod -R go-w,go+rX /var/lib/spamassassin/compiled
    fi
}

# Tell a running spamd to reload its configs and rules.
reload() {
    # Reload
    if which invoke-rc.d >/dev/null 2>&1; then
        invoke-rc.d spamassassin reload > /dev/null
    else
        /etc/init.d/spamassassin reload > /dev/null
    fi
    if [ -d /etc/spamassassin/sa-update-hooks.d ]; then
        run-parts --lsbsysinit /etc/spamassassin/sa-update-hooks.d
    fi
}

# Sleep for up to 3600 seconds if not running interactively
if [ ! -t 0 ]; then
    RANGE=3600
    number=`od -vAn -N2 -tu4 < /dev/urandom`
    number=`expr $number "%" $RANGE`
    sleep $number
fi

# Update
umask 022
env -i LANG="$LANG" PATH="$PATH" start-stop-daemon \
    --chuid debian-spamd:debian-spamd --start \
    --exec /usr/bin/sa-update -- \
    --gpghomedir /var/lib/spamassassin/sa-update-keys 2>&1

case $? in
    0)
        # got updates!
        env -i LANG="$LANG" PATH="$PATH" start-stop-daemon \
            --chuid debian-spamd:debian-spamd --start \
            --exec /usr/bin/spamassassin -- --lint 2>&1 || die_with_lint
        do_compile
        reload
        ;;
    1)
        # no updates
        exit 0
        ;;
    2)
        # lint failed!
        die_with_lint
        ;;
    *)
        echo "sa-update failed for unknown reasons" 1>&2
        ;;
esac

# Local variables:
# mode: shell-script
# tab-width: 4
# indent-tabs-mode: nil
# end:

I've tried doing a "systemctl enable spamassassin.service", with no difference. Still the same error every time. It doesn't seem to be impacting much of anything that I'm aware of, but still, the Anacron failure notices every day are a little bit disquieting. I'm not quite sure why this script seems to be failing every single day, but it has been for the last few days, and I'm not quite sure why... Anyone have any advice / words of wisdom? I'm sure that I'm missing something that's probably going to become obvious as soon as I hit "Submit Topic", but just in case it doesn't become readily apparent, perhaps someone can clue me in on what may be the culprit?

Thanks!

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2 (edited by SteveLuxe 2015-06-17 01:33:49)

Re: Cron Daily and Spamassassin Failure

Should I perhaps comment out the following lines in /etc/cron.daily/spamassassin ? Would this fix the issue?

# Tell a running spamd to reload its configs and rules.
reload() {
    # Reload
    if which invoke-rc.d >/dev/null 2>&1; then
        invoke-rc.d spamassassin reload > /dev/null
    else
        /etc/init.d/spamassassin reload > /dev/null
    fi

3

Re: Cron Daily and Spamassassin Failure

SteveLuxe wrote:

Should I perhaps comment out the following lines in /etc/cron.daily/spamassassin ? Would this fix the issue?

# Tell a running spamd to reload its configs and rules.
reload() {
    # Reload
    if which invoke-rc.d >/dev/null 2>&1; then
        invoke-rc.d spamassassin reload > /dev/null
    else
        /etc/init.d/spamassassin reload > /dev/null
    fi

It should be sufficient to make this change:

    0)
        # got updates!
        env -i LANG="$LANG" PATH="$PATH" start-stop-daemon \
            --chuid debian-spamd:debian-spamd --start \
            --exec /usr/bin/spamassassin -- --lint 2>&1 || die_with_lint
        do_compile
        # disabled since spamassassin does not run as service under iredmail
        #reload
        ;;

Let me know if this fixes your issue.

4

Re: Cron Daily and Spamassassin Failure

Thanks Mir! I gave it a shot, and I'll see if that fixes the issue... Hopefully it's as simple as just commenting out the reload command! smile I guess I'll find out tomorrow morning when Anacron does its thing! Thank you!

5

Re: Cron Daily and Spamassassin Failure

And indeed, Mir for the win! Thank you, Mir! Your solution of commenting out that one line did the trick! No failure notifications today!