#!/bin/bash # # greylistd This shell script takes care of starting and stopping greylistd # # chkconfig: - 79 31 # description: Greylistd is a Mail Transport Agent, which is the program \ # that moves mail from one machine to another. # processname: greylistd # config: /etc/greylistd/config # xxx-pidfile: /var/run/greylistd.pid # Source function library. . /etc/init.d/functions # Source networking configuration. . /etc/sysconfig/network start() { # Start daemons. echo -n $"Starting greylistd: " # daemon --user greylistd /usr/sbin/greylistd initlog $INITLOG_ARGS -c "su -s /bin/bash - greylistd -c \"/usr/sbin/greylistd > /dev/null 2>&1 &\"" sleep 2 ps uax | grep -v grep | grep '/usr/sbin/greylistd' > /dev/null RETVAL=$? base=greylistd [ "$RETVAL" -eq 0 ] && success $"$base startup" || failure $"$base startup" echo [ $RETVAL = 0 ] && touch /var/lock/subsys/greylistd } stop() { # Stop daemons. echo -n $"Shutting down greylistd: " rm -f /var/run/greylistd/socket killproc greylistd RETVAL=$? echo [ $RETVAL = 0 ] && rm -f /var/lock/subsys/greylistd } restart() { stop start } # See how we were called. case "$1" in start) start ;; stop) stop ;; reload) restart ;; restart) restart ;; condrestart) [ -f /var/lock/subsys/greylistd ] && restart || : ;; status) status greylistd ;; *) echo $"Usage: $0 {start|stop|restart|status|condrestart}" exit 1 esac exit $RETVAL