#!/bin/sh # # 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: /etc/exim.conf # pidfile: /var/run/exim.pid # Source function library. . /usr/local/etc/rc.d/functions # Source exim configureation. if [ -f /etc/sysconfig/exim ] ; then . /etc/sysconfig/exim else DAEMON=yes QUEUE=1h fi [ "$DAEMON" = yes ] && EXIM_OPTS="$EXIM_OPTS -bd" [ -n "$QUEUE" ] && EXIM_OPTS="$EXIM_OPTS -q$QUEUE" [ -f /usr/sbin/exim ] || exit 0 SPAM_PID=/var/run/spamd.pid start() { # Start daemons. echo -n "Starting exim: " daemon /usr/sbin/exim $EXIM_OPTS -oP /var/run/exim.pid RETVAL=$? if [ $RETVAL = 0 ] && touch /var/spool/lock/exim then echo -e "\t\t[ OK ]"; else echo -e "\t\t[ FAILED ]"; fi if [ -e /usr/bin/spamd ]; then /usr/bin/spamd -d -c -m 15 --ipv4 --pidfile=$SPAM_PID 1>/dev/null 2>/dev/null; fi } stop() { # Stop daemons. echo -n "Shutting down exim: " killall exim 2> /dev/null RETVAL=$? if [ $RETVAL = 0 ] && rm -f /var/spool/lock/exim then echo -e "\t[ OK ]"; else echo -e "\t[ FAILED ]"; fi if [ -e /usr/bin/spamd ]; then if [ -s $SPAM_PID ]; then kill `cat ${SPAM_PID}` else killall -9 spamd fi fi } restart() { stop start } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) restart ;; condrestart) [ -f /var/lock/subsys/exim ] && restart || : ;; status) status exim ;; *) echo "Usage: exim {start|stop|restart|status|condrestart}" exit 1 esac exit $RETVAL