File postgrey.init of Package postgrey
#!/bin/sh
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
# Copyright (c) 2008 SUSE LINUX Products AG, Nuernberg, Germany.
# All rights reserved.
#
# Author: Klaus Singvogel.
# Please send feedback to http://www.suse.de/feedback
#
# /etc/init.d/postgrey
# and its symbolic link
# /(usr/)sbin/rcpostgrey
#
# postgrey This shell script takes care of starting and stopping
# postgrey.
#
#
### BEGIN INIT INFO
# Provides: postgrey
# Required-Start: $syslog $local_fs $network $named $time
# Should-Start: cyrus ldap ypbind sendmail $remote_fs
# Required-Stop: $syslog $local_fs
# Should-Stop: $time ypbind sendmail $remote_fs
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Postgrey a greylisting server for postfix
# Description: Postgrey is a Postfix policy server implementing greylisting
### END INIT INFO
#
POSTGREY_BIN=/usr/sbin/postgrey
POSTGREY_SYSCONFIG=/etc/sysconfig/postgrey
if [ ! -x $POSTGREY_BIN ] ; then
echo -n "Postfix greylisting server postgrey not installed ! "
exit 5
fi
if [ ! -r $POSTGREY_SYSCONFIG ]; then
echo "$POSTGREY_SYSCONFIG not existing";
if [ x"$1" = x"stop" ]; then
exit 0
else
exit 6
fi
fi
# Load options file
. $POSTGREY_SYSCONFIG
# glue all the sysconfig options to one - easier handling
POSTGREY_OPTIONS="$POSTGREY_CONN_OPTIONS $POSTGREY_DBDIR $POSTGREY_EXTRA_OPTIONS"
# Source SuSE config, only if exists with size greater zero
test -s /etc/rc.status && . /etc/rc.status
rc_reset
case "$1" in
start)
echo -n "Starting postgrey daemon"
## Start daemon with startproc(8). If this fails
## the echo return value is set appropriate.
startproc "$POSTGREY_BIN" -d $POSTGREY_OPTIONS
rc_status -v
;;
stop)
echo -n "Shutting down postgrey daemon"
## Stop daemon with killproc(8) and if this fails
## set echo the return value.
killproc -TERM "$POSTGREY_BIN"
rc_status -v
;;
try-restart)
$0 status >/dev/null && $0 restart
# Remember status and be quiet
rc_status
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
# Remember status and be quiet
rc_status
;;
force-reload)
echo -n "Reload service postgrey not possible"
rc_failed 3
rc_status -v
;;
reload)
## Send daemon HUP signal with killproc(8) and if this
## fails set echo the return value.
killproc -HUP "$POSTGREY_BIN"
rc_status -v
;;
status)
echo -n "Checking for service postgrey: "
checkproc "$POSTGREY_BIN"
rc_status -v
;;
*)
echo "Usage: postgrey {start|stop|try-restart|restart|reload|status}"
exit 1
esac
rc_exit