Re: [Exim] chkconfig on RH

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Mike Zanker
Datum:  
To: exim-users
Betreff: Re: [Exim] chkconfig on RH
On 02 August 2004 10:21 -0500 ListServ <knothead@???>
wrote:

> I am trying to add an entry into chkconfig (/etc/init.d) on a Redhat
> AS3 box. Would someone like to tell me what I am doing wrong. If I
> cannot use RH native utilities what do I use?


/etc/init.d/exim has to be a script with a specific structure to be
accepted by chkconfig. I adapted the sendmail script as follows:

-------------------------------------
#!/bin/bash
#
# exim      This shell script takes care of starting and stopping
#               exim.
#
# chkconfig: 2345 80 30
# description: exim is a Mail Transport Agent, which is the program \
#              that moves mail from one machine to another.
# processname: exim
# config: /usr/local/exim/configure
# pidfile: /var/spool/exim/exim-daemon.pid


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

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

# Source exim configuration.
if [ -f /etc/sysconfig/exim ] ; then
        . /etc/sysconfig/exim
else
        DAEMON=no
        QUEUE=1h
fi


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

[ -f /usr/local/exim/bin/exim ] || exit 0

RETVAL=0
prog="exim"

start() {
        # Start daemons.


        echo -n $"Starting $prog: "
        daemon /usr/local/exim/bin/exim $([ "$DAEMON" = yes ] && echo
-bd) \
                                  $([ -n "$QUEUE" ] && echo -q$QUEUE)
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/exim
        return $RETVAL
}


stop() {
        # Stop daemons.
        echo -n $"Shutting down $prog: "
        killproc exim
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/exim
        return $RETVAL
}


# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart|reload)
        stop
        start
        RETVAL=$?
        ;;
  condrestart)
        if [ -f /var/lock/subsys/exim ]; then
            stop
            start
            RETVAL=$?
        fi
        ;;
  status)
        status exim
        RETVAL=$?
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart|condrestart|status}"
        exit 1
esac


exit $RETVAL

----------------------------------

/etc/sysconfig/exim contains

DAEMON=yes
QUEUE=15m


Then you can:

chkconfig --add exim
chkconfig --level 2345 exim on
/etc/init.d/exim start

--
Mike Zanker
Northampton, UK
PGP Public Key: pgp@???