05 Sep 2008 
Support Center » Knowledgebase » How to create startup script for ClamAV on Mac OS X
 How to create startup script for ClamAV on Mac OS X
Solution

Problem

The article is related to ClamAV antivirus. After the installation there is no startup script to run clamd (ClamAV deamon) upon the system startup. This article describes how to create a startup script to work properly with Kerio MailServer.

IMPORTANT: This is not the default configuration hence it is not supported by Kerio Technologies. You are doing all changes at your own risk!

Step By Step Guide

The clamd process on OS X Server is installed by default, but does not run. If script is not correctly created, the clamd process can be started later then Kerio MailServer process, which will cause problems with antivirus initilization.

  1. Creating blank startup files and assigning rights

    sudo mkdir /Library/StartupItems/ClamAV
    cd /Library/StartupItems/ClamAV
    touch StartupParameters.plist ClamAV
    chmod 755 ClamAV
    chmod 644 StartupParameters.plist
  2. The StartupParameters.plist file should contain following information. Edit this file and enter the following information. You can also use prepared example file. If you do so, don't forget to assign proper rights using the chmod command.

    {
    Decription = "ClamAV";
    Provides = ("ClamAV");
    OrderPreference = "Early";
    Messages =
    {
    start = "Starting ClamAV";
    stop = "Stopping ClamAV";
    };
    }
  3. The ClamAV file should contain following information. As before, edit the file and enter the following information. You can also use prepared example file. If you do so, don't forget to assign proper rights using the chmod command.

    #!/bin/sh

    ##
    # ClamAV
    #
    # Radek Sip, Kerio Technologies (c) 2006
    ##

    . /etc/rc.common

    StartService ()
    {
    ConsoleMessage "Starting ClamAV"
    exec /usr/sbin/clamd
    }

    StopService ()
    {
    ConsoleMessage "Stopping ClamAV"
    killall clamd
    }

    RestartService ()
    {
    ConsoleMessage "Restarting ClamAV"
    StopService
    StartService
    }

    RunService "$1"
  4. Optional settings

    These are optional settings which may help set startup order. clamd needs to be running while Kerio MailServer is starting. Otherwise the antivirus plugin will not be iniciated properly and antivirus check will not work.

    • Settings in /Library/StartupItems/KerioMailServer/StartupParameters.plist

      • Kerio MailServer uses OrderPreference = "Late"; by default, it is possible to change this value to Last. This will make Kerio MailServer startup later.
    • In "Requires" settings is possible to set services which needs to be started prior to Kerio MailServer service

      Requires = ("Network","Resolver");

      You can add the service name of ClamAV antivirus which can be found in Provides attribute in /Library/StartupItems/ClamAV/StartupParameters.plist startup file. This will cause Kerio MailServer to not start if ClamAV is not running. Note: if ClamAV service becomes stopped, Kerio MailServer service will be stopped too



Article Details
Article ID: 425
Created On: 20 Jun 2006 04:32 PM
Author:
Last Edit:

 This answer was helpful  This answer was not helpful

 Back
 Login [Lost Password] 
Email:
Password:
Remember Me:
 
 Search
 Article Options
Home | Register | Submit a Ticket | Knowledgebase | Troubleshooter | User Forum | Downloads
Language:

Help Desk Software By Kayako SupportSuite v3.20.02