Sophie

Sophie

distrib > * > 2008.0 > x86_64 > by-pkgid > e734982fffa1dab24cbdd05b32c6b006 > files > 4

sqlgrey-1.7.5-1mdv2008.0.src.rpm

#!/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

# 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