2010-05-14 06:21:07 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2012-05-29 23:40:00 +02:00
|
|
|
# Copyright (c) 2008-2012, Nishant Limbachia, Hoffman Estates, IL, USA
|
2010-05-14 06:21:07 +02:00
|
|
|
#
|
|
|
|
# /etc/rc.d/rc.policyd2
|
|
|
|
# start|stop|restart|status Policyd2 daemon
|
|
|
|
#
|
|
|
|
# The PIDFILE is setup in the config file. Default is /var/run/policyd2.pid
|
|
|
|
# If you change the location in the config file then it **needs** to be
|
2011-07-16 20:53:01 +02:00
|
|
|
# changed here too for the script to work correctly.
|
2010-05-14 06:21:07 +02:00
|
|
|
|
|
|
|
PIDFILE="/var/run/policyd2.pid"
|
|
|
|
CONFIG="/etc/policyd2.conf"
|
|
|
|
|
|
|
|
policyd2_start() {
|
|
|
|
if [ -x /etc/rc.d/rc.policyd2 ]; then
|
|
|
|
if [ -f $PIDFILE ]; then
|
|
|
|
echo "Policyd2 daemon running with PID: $(cat $PIDFILE)"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "Starting Policyd2 daemon"
|
|
|
|
/usr/sbin/cbpolicyd -c $CONFIG
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
policyd2_stop() {
|
|
|
|
if [ -f $PIDFILE ]; then
|
|
|
|
echo "Stopping Policyd2 daemon"
|
|
|
|
killall cbpolicyd && rm -f $PIDFILE
|
|
|
|
else
|
|
|
|
echo "Policyd2 daemon is not running"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
policyd2_restart() {
|
|
|
|
policyd2_stop
|
|
|
|
sleep 5
|
|
|
|
policyd2_start
|
|
|
|
}
|
|
|
|
|
|
|
|
policyd2_status() {
|
|
|
|
if [ -f $PIDFILE ]; then
|
|
|
|
echo "Policyd2 daemon running with PID: $(cat $PIDFILE)"
|
|
|
|
else
|
|
|
|
echo "Policyd2 daemon doesn't seem to be running!"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
'start')
|
|
|
|
policyd2_start
|
|
|
|
;;
|
|
|
|
'stop')
|
|
|
|
policyd2_stop
|
|
|
|
;;
|
|
|
|
'restart')
|
|
|
|
policyd2_restart
|
|
|
|
;;
|
|
|
|
'status')
|
|
|
|
policyd2_status
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "USAGE: $0 start|stop|restart|status"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|