#!/bin/bash
#
# chkconfig: - 75 25
# description: Postfix Policy Daemon
# processname: httpd
# config: /etc/policyd/cluebringer.conf
# pidfile: /var/run/cbpolicyd.pid
# processname: cbpolicyd

# source function library
. /etc/init.d/functions

# Get config.
. /etc/sysconfig/network

# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0


RETVAL=0


start() {
	echo -n $"Starting cbpolicyd: "
        daemon /usr/sbin/cbpolicyd --config /etc/policyd/cluebringer.conf
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/cbpolicyd
	return $RETVAL
}


stop() {
	echo -n $"Shutting down cbpolicyd: "
	killproc cbpolicyd
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/cbpolicyd
}

restart() {
	stop
	start
}	


case "$1" in
  start)
  	start
	;;
  stop)
  	stop
	;;
  restart|reload)
	restart
        ;;
  condrestart)
        if [ -f /var/lock/subsys/cbpolicyd ]; then
		restart
        fi
        ;;
  status)
        status cbpolicyd
	RETVAL=$?
        ;;
  *)
	echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}"
	exit 1
esac

exit $RETVAL
