2010-05-11 20:01:41 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# /etc/rc.d/rc.policyd
|
|
|
|
#
|
2010-05-12 17:44:08 +02:00
|
|
|
# start/stop/restart Policy daemon for Postfix
|
|
|
|
#
|
2010-05-11 20:01:41 +02:00
|
|
|
# The PIDFILE is setup in the config file. Default is /var/run/policyd.pid
|
2010-05-12 17:44:08 +02:00
|
|
|
# If you change the location in the config file then it **needs** to be
|
|
|
|
# changed here too.
|
|
|
|
|
2010-05-11 20:01:41 +02:00
|
|
|
PIDFILE="/var/run/policyd.pid"
|
|
|
|
CONFIG="/etc/policyd.conf"
|
|
|
|
|
|
|
|
policyd_start() {
|
|
|
|
if [ -x /etc/rc.d/rc.policyd ]; then
|
2010-05-12 17:44:08 +02:00
|
|
|
if [ -f $PIDFILE ]; then
|
|
|
|
echo "Policy daemon seems to be running with PID: $(cat $PIDFILE)"
|
|
|
|
else
|
|
|
|
if [ -r "$CONFIG" ]; then
|
|
|
|
echo "Starting Policy daemon"
|
|
|
|
/usr/bin/policyd -c $CONFIG
|
|
|
|
else
|
|
|
|
echo "$CONFIG is missing or unreadable. Exiting..."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
2010-05-11 20:01:41 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
policyd_stop() {
|
2010-05-12 17:44:08 +02:00
|
|
|
if [ -f $PIDFILE ]; then
|
|
|
|
echo "Stopping Policy daemon"
|
|
|
|
/bin/kill $(cat $PIDFILE)
|
|
|
|
rm -f $PIDFILE
|
|
|
|
else
|
|
|
|
echo "Policy daemon is not running..."
|
|
|
|
exit 1
|
|
|
|
fi
|
2010-05-11 20:01:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
policyd_restart() {
|
|
|
|
policyd_stop
|
|
|
|
sleep 2
|
|
|
|
policyd_start
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
'start')
|
|
|
|
policyd_start
|
|
|
|
;;
|
|
|
|
'stop')
|
|
|
|
policyd_stop
|
|
|
|
;;
|
|
|
|
'restart')
|
|
|
|
policyd_restart
|
|
|
|
;;
|
2010-05-12 17:44:08 +02:00
|
|
|
*)
|
2010-05-11 20:01:41 +02:00
|
|
|
echo "USAGE: $0 start|stop|restart"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
2010-05-12 17:44:08 +02:00
|
|
|
|