aboutsummaryrefslogtreecommitdiff
path: root/network/policyd2/rc.policyd2
diff options
context:
space:
mode:
authorNishant Limbachia <nishant@mnspace.net>2010-05-13 23:21:07 -0500
committerRobby Workman <rworkman@slackbuilds.org>2010-05-16 22:24:33 -0500
commit58d3760cc703f1527a213560cc71b97cd31f4521 (patch)
treed498dd0f34921edbf92d8ba0d0461a73b1637860 /network/policyd2/rc.policyd2
parentc300db04940ef5b0e82bf05f7f2f84ce26720fd4 (diff)
network/policyd2: Added (policy server for MTAs).
Diffstat (limited to 'network/policyd2/rc.policyd2')
-rw-r--r--network/policyd2/rc.policyd267
1 files changed, 67 insertions, 0 deletions
diff --git a/network/policyd2/rc.policyd2 b/network/policyd2/rc.policyd2
new file mode 100644
index 0000000000000..80c95986352cc
--- /dev/null
+++ b/network/policyd2/rc.policyd2
@@ -0,0 +1,67 @@
+#!/bin/sh
+#
+# Copyright (c) 2008-2010, Nishant Limbachia, Hoffman Estates, IL, USA
+#
+# /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
+# changed here too for the script to work correctly
+
+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