[Greylist-users] Fedora postgrey init script

Matt Huston matthewhuston at gmail.com
Wed May 24 10:56:18 PDT 2006


If anyone wants a skeletal /etc/rc.d/init.d script for Postgrey and
chkconfig, here is a quick one: (I searched as much as I could stand
and couldn't find one, pls forgive if redundant/already posted, just
passing this on)
#!/bin/bash
#
# postfix      This shell script takes care of starting and stopping
#               postgrey.
#
# chkconfig: 2345 80 30
# description: Postgrey see http://isg.ee.ethz.ch/tools/postgrey/
# processname: postgrey
# config: /etc/postfix/
# pidfile: /var/lock/subsys/postgrey.pid

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

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

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
#/home/matt/postgrey/postgrey-1.24/postgrey
if [ ! -f /home/matt/postgrey/postgrey-1.24/postgrey  ]
then
  echo Error accessing command
  exit 0
fi

#[ -d /etc/postfix ] || echo No postgrey config directory; exit 0
#[ -d /var/spool/postfix/postgrey ] || echo No postgrey data directory; exit 0

#echo Mad
RETVAL=0
#THECMD=<substitute for your instance of the .pl script>
THECMD=/home/matt/postgrey/postgrey-1.24/postgrey

# See how we were called:


case "$1" in
  start)
        # Start daemons.
        echo -n "Starting postgrey: "
        $THECMD --inet=10023 -d --pidfile=/var/lock/subsys/postgrey.pid
        RETVAL=$?
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/postgrey
        ;;
  stop)
        # Stop daemons.
        echo -n "Shutting down postgrey: "
        killproc $THECMD -9
        RETVAL=$?
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/postgrey
        echo
        ;;
  restart)
        $0 stop
        $0 start
        ;;
  *)
        echo "Usage: postgrey
{start|stop|restart}"
        exit 1
esac

exit $RETVAL



More information about the Greylist-users mailing list