init.d script

Gerhard Mourani gmourani at prival.ca
Fri May 11 16:36:59 IST 2007


Claude,

That's the one I use, it's not perfect but a good starting point.

#!/bin/bash
#
# Modified for OpenNA Linux by Gerhard Mourani <gmourani at openna.com>
# This shell script takes care of starting and stopping MailScanner.
#
# chkconfig: 345 80 30
# description: MailScanner is an open-source E-Mail Gateway Virus Scanner.
# processname: MailScanner
# config: /etc/MailScanner/MailScanner.conf
# pidfile: /var/run/MailScanner.pid

# Source function library.
. /etc/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -f /usr/sbin/check_MailScanner ] || exit 0

RETVAL=0
prog="mailscanner"

start() {
        echo -n "Starting $prog: "
        /usr/sbin/check_MailScanner >/dev/null
        RETVAL=$?
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/MailScanner
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/MailScanner.off
        echo
        return $RETVAL
}

stop() {
        echo -n "Shutting down $prog: "
        killproc MailScanner -15
        RETVAL=$?
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/MailScanner
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/MailScanner.off
        rm -f /var/run/MailScanner.pid
        echo
        return $RETVAL
}

restart() {
        stop
        start
}

reload() {
        pid=`pidofproc MailScanner`
        if [ -z "$pid" ] ; then
          failure
        else
          /bin/kill -HUP -- -$pid
          success
        fi
        echo
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  reload)
        reload
        ;;
*)
        echo $"Usage: $0 {start|stop|restart|reload}"
        exit 1
esac
exit $RETVAL

Gerhard,

-----Original Message-----
From: mailscanner-bounces at lists.mailscanner.info [mailto:mailscanner-bounces at lists.mailscanner.info] On Behalf Of Claude Gagné
Sent: Friday, May 11, 2007 11:33 AM
To: MailScanner discussion
Subject: Re: init.d script

Res a écrit :
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> This is for RPM versions, tarball install everything under /opt
>
> We don't really need it :)
>
> On Fri, 11 May 2007, Claude Gagné wrote:
>
>> Hi,
>>
>> I use the tarball installation of the lastest MailScanner on Ubuntu 
>> Server but I can't find the /etc/init.d script that everybody seems 
>> to have. I have searched on the wiki and MS web site but I can't find 
>> it.
>>
>> Any can tell me where can I get it ?
>>
>> Thanks.
>>
>> Claude
>>
>
> - --
> Cheers
> Res
>
> Vote for your favourite MTA at  http://polls.ausics.net/v3.php
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFGRIHjsWhAmSIQh7MRAgsYAJ9y88a7iWSzKTcG2uRVl1m9Fx3VZwCcC3/E
> 7jLaKHO0eGTLI1UYI9w40d4=
> =DvZt
> -----END PGP SIGNATURE-----
It can be usefull to reload configuration without killing all 
MailScanner process and restart. Or is it other ways to do it ?

Thanks for your help :)

Claude
-- 
MailScanner mailing list
mailscanner at lists.mailscanner.info
http://lists.mailscanner.info/mailman/listinfo/mailscanner

Before posting, read http://wiki.mailscanner.info/posting

Support MailScanner development - buy the book off the website! 

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the MailScanner mailing list