aboutsummaryrefslogtreecommitdiff
path: root/system/cfengine/rc.cfengine
blob: a58103c72a8c207bff47cd47d3d5376ff5f05ff4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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