#!/bin/sh # # sqlgrey: Init script for sqlgrey postfix policy service # # chkconfig: - 79 31 # description: SQLgrey is a postfix grey-listing policy service. # pidfile: /var/run/sqlgrey.pid ### BEGIN INIT INFO # Provides: sqlgrey # Required-Start: $network # Required-Stop: $network # Should-Start: postfix # Should-Stop: postfix # Short-Description: Starts the sqlgrey daemon # Description: SQLgrey is a postfix grey-listing policy service. # ### END INIT INFO # Source function library. . /etc/init.d/functions RETVAL=0 start() { echo -n $"Starting SQLgrey: " # SQLite put files in the working directory cd ~sqlgrey || RETVAL=1 [ $RETVAL -eq 0 ] && { daemon sqlgrey -d; RETVAL=$?; }; [ $RETVAL -eq 0 ] && { touch /var/lock/subsys/sqlgrey; RETVAL=$?; }; [ $RETVAL -eq 0 ] && echo_success || echo_failure echo } stop() { echo -n $"Shutting down SQLgrey: " sqlgrey -k || RETVAL=1 [ $RETVAL -eq 0 ] && { rm -f /var/lock/subsys/sqlgrey; RETVAL=$?; }; [ $RETVAL -eq 0 ] && echo_success || echo_failure echo } restart() { stop sleep 1 # hack: missing REUSEADDR from Net::Server? start } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status sqlgrey ;; reload) restart ;; restart) restart ;; condrestart) [ -f /var/lock/subsys/sqlgrey ] && restart || : ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart}" exit 1 esac exit $RETVAL