1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
#!/bin/sh
#
# sqlgrey: Init script for sqlgrey postfix policy service
#
# chkconfig: 345 90 10
# description: SQLgrey is a postfix grey-listing policy service.
# pidfile: /var/run/sqlgrey.pid
#
# Hacked from the RH version Karl O. Pinc <kop@meme.com>
# Source function library.
#. /etc/init.d/functions
SQLGREY=/usr/sbin/sqlgrey
# See how we were called.
case "$1" in
start)
echo -n "Starting sqlgrey: "
# SQLite put files in the working directory
ERRMSG=$(/sbin/start-stop-daemon --chdir ~sqlgrey --pidfile /var/run/sqlgrey.pid --oknodo --startas $SQLGREY --start -- -d 2>&1)
if [ $? != 0 ]; then
echo "(FAILED)"
[ "$ERRMSG" ] && echo "ERROR: $ERRMSG" >&2 || true
exit 1
fi
[ "$ERRMSG" ] && echo -n " ($ERRMSG)" >&2 || true
echo "done."
;;
stop)
echo -n "Stopping sqlgrey:"
sqlgrey -k
echo " done."
start-stop-daemon --start --exec $SQLGREY -- -k
;;
restart)
$0 stop
sleep 1 # hack: missing REUSEADDR from Net::Server?
$0 start
;;
*)
echo "Usage: sqlgrey {start|stop|restart}"
exit 1
esac
exit 0
|