aboutsummaryrefslogtreecommitdiff
path: root/system/cfengine/rc.cfengine
diff options
context:
space:
mode:
Diffstat (limited to 'system/cfengine/rc.cfengine')
-rw-r--r--system/cfengine/rc.cfengine51
1 files changed, 51 insertions, 0 deletions
diff --git a/system/cfengine/rc.cfengine b/system/cfengine/rc.cfengine
new file mode 100644
index 0000000000000..a58103c72a8c2
--- /dev/null
+++ b/system/cfengine/rc.cfengine
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+# Start cfengine:
+cfengine_start() {
+ if [ -x /usr/sbin/cfexecd ]; then
+ # Make sure localhost keys exist first
+ if [ ! -f /var/cfengine/ppkeys/localhost.priv ]; then
+ /usr/sbin/cfkey
+ fi
+ echo "Starting Cfengine: /usr/sbin/cfexecd"
+ /usr/sbin/cfexecd
+ fi
+}
+
+# Stop cfengine:
+cfengine_stop() {
+ /bin/killall cfenvd 2> /dev/null
+ /bin/killall cfexecd 2> /dev/null
+ /bin/killall cfservd 2> /dev/null
+}
+
+# Restart cfengine:
+cfengine_restart() {
+ cfengine_stop
+ sleep 1
+ cfengine_start
+}
+
+# Reload cfengine:
+cfengine_reload() {
+ /bin/killall -HUP cfenvd
+ /bin/killall -HUP cfexecd
+ /bin/killall -HUP cfservd
+}
+
+case "$1" in
+'start')
+ cfengine_start
+ ;;
+'stop')
+ cfengine_stop
+ ;;
+'restart')
+ cfengine_restart
+ ;;
+'reload')
+ cfengine_reload
+ ;;
+*)
+ echo "usage $0 start|stop|restart|reload"
+esac