Home Forums OS X Server and Client Discussion Mail clamav + amavisd startup

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #357785
    bustthis
    Participant

    hi,

    i recently installed amavis and clamav with spamsssassin. i tried to get them to startup when postfix starts, but it’s not working at all.

    here is what i added to /System/Library/StartupItems/Postfix/Postfix:

    . /etc/rc.common

    StartService ()
    {
    if [ “${MAILSERVER:=-NO-}” = “-YES-” ]; then
    ConsoleMessage “Starting mail services”
    /usr/bin/spamd -d -a
    su clamav -c /usr/local/sbin/clamd
    su clamav -c amavisd
    /usr/sbin/postfix start
    elif [ “${MAILSERVER:=-NO-}” = “-AUTOMATIC-” ]; then
    /usr/sbin/postfix-watch
    fi
    }

    StopService ()
    {
    ConsoleMessage “Stopping Postfix mail services”
    /usr/sbin/postfix stop
    killall -1 postfix-watch 2> /dev/null
    }

    RestartService ()
    {
    if [ “${MAILSERVER:=-NO-}” = “-YES-” ]; then
    ConsoleMessage “Reloading Postfix configuration”
    /usr/sbin/postfix reload
    else
    StopService
    fi
    }

    RunService “$1”

    i added the clam-update log to cron.

    when i restart my server, i know it’s not running because all mail is refused and i need to start amavis manually each time in order to get mail.

    also, can someone tell me what this means?

    Apr 10 20:35:57 charles-x postfix/pipe[15746]: 99AE369531: to=<[email protected]>, relay=procmail, delay=8, status=deferred (temporary failure. Command output: procmail: Couldn’t read “/Users/virusalert/.procmailrc” procmail: Program failure (65) of “/usr/bin/cyrus/bin/deliver” )

    any suggestions?

    #357857
    Anonymous
    Participant

    Try this:
    Create a directory in /Library/StartupItems – name it Amavis
    Make sure permissions are correct.
    Inside the Amavis directory, create a file: Amavis
    Insert this into Amavis file:

    #!/bin/sh

    . /etc/rc.common

    StartService ()
    {
    if [ “${Amavis:=-NO-}” = “-YES-” ]; then
    ConsoleMessage “Starting Amavis”
    su clamav -c amavisd
    freshclam -d -c 2 -l /var/log/clam-update.log
    fi
    }

    StopService ()
    {
    ConsoleMessage “Stopping Amavis”
    }

    RunService “$1”

    Inside the Amavis directory, create a file: StartupParameters.plist
    Insert this into StartupParameters.plist:

    {
    Description = “Whatever You Want It To Say”;
    Provides = (“Amavis”);
    Requires = (“Resolver”);
    Preference = “None”;
    Messages =
    {
    start = “Starting Amavis”;
    stop = “Stopping Amavis”;
    };
    }

    Ceate a line in /etc/hostconfg and add this to the bottom:

    Amavis=-YES-

    Hope this does it.

    #357901
    Anonymous
    Participant

    i got it to work before i got your post, pretty much exactly the same way… but i never added the line to etc/hostconfig – do i need that? it works without it and i guess it’s a stupid question 🙂

    #358422
    Anonymous
    Participant

    I used the second script, set up per suggestions…. and my amavisd *still* won’t start at startup. If I restart the mail server for any reason, I still have to launch amavisd manually via terminal.

    Help???

    #358444
    bustthis
    Participant

    this is what works for me:

    #!/bin/sh

    . /etc/rc.common

    StartService ()
    {
    ConsoleMessage “Starting Amavis anti-virus/spam daemon.”
    if [ ! -d /var/run/clamav ] ; then
    mkdir /var/run/clamav
    fi
    chown clamav /var/run/clamav
    su clamav -c /usr/local/sbin/clamd
    /usr/bin/su clamav -c amavisd
    /usr/local/bin/freshclam -d -c 6 -l /var/log/clam-update.log
    }

    StopService ()
    {
    ConsoleMessage “Stopping Amavis anti-virus/spam daemon.”
    kill -1 `cat /var/amavis/amavisd.pid`
    killall freshclam
    killall clamd
    }

    RestartService ()
    {
    StopService
    StartService
    }

    RunService “$1”

    StartupParameters.plist:

    {
    Description = “Amavis anti-virus/spam-control daemon”;
    Provides = (“AV-Spam”);
    Requires = (“Resolver”);
    Uses = (“Network Time”, “NFS”);
    Preference = “None”;
    Messages =
    {
    start = “Starting Amavis”;
    stop = “Stopping Amavis”;
    restart = “Restarting Amavis”;
    };
    }

    permissions:
    -rwxr-xr-x 1 root wheel 860 11 Jun 23:12 Amavis
    -rw-r–r– 1 root wheel 315 11 Jun 23:12 StartupParameters.plist

    you might want to take out the clam lines.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Comments are closed