#!/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/sqlgrey.pid

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

# See how we were called.
case "$1" in
  start)
	gprintf "Starting SQLgrey: "
	# SQLite put files in the working directory
	cd /var/lib/sqlgrey
	sqlgrey -d
	touch /var/lock/subsys/sqlgrey
	echo
	;;
  stop)
	gprintf "Stopping SQLgrey: "
	killproc sqlgrey
	rm -f /var/lock/subsys/sqlgrey
	echo 
	;;
  status)
	status sqlgrey
	;;
  restart|reload)
	$0 stop
	$0 start
	;;
  *)
	gprintf "Usage: sqlgrey {start|stop|status|restart|reload}\n"
	exit 1
esac

exit 0
