It's pretty simple and it works for me on ubuntu.

#!/bin/sh

NAME=cbpolicyd
DAEMON=/usr/local/bin/$NAME
PIDFILE=/var/run/$NAME.pid

[ -f $DAEMON ] || exit 0

. /lib/lsb/init-functions

case "$1" in
        start)
                log_daemon_msg "Starting the $NAME daemon"
                start-stop-daemon --start --quiet --oknodo --exec $DAEMON
                log_end_msg $?
                ;;

        stop)
                log_daemon_msg "Stopping $NAME daemon"
                log_end_msg $?
                start-stop-daemon --retry 30 --stop --quiet --pidfile $PIDFILE
                ;;

        status)
                # We want to maintain backward compatibility with Dapper,
                # so we're not going to use status_of_proc()
                pidofproc -p $PIDFILE $DAEMON >/dev/null
                status=$?
                if [ $status -eq 0 ]; then
                        log_success_msg "$NAME is running"
                else
                        log_failure_msg "$NAME is not running"
                fi
                exit $status
                ;;

        restart|force-reload)
                $0 stop && $0 start
                ;;

        *)
                echo "Usage: $0 {start|stop|status|restart|force-reload}"
                exit 1
                ;;
esac

exit 0

_______________________________________________
Users mailing list
[email protected]
http://lists.policyd.org/mailman/listinfo/users

Reply via email to