summaryrefslogtreecommitdiff
path: root/system/cfengine/rc.cfengine
blob: 08a3300d627baa16c1a5856cf9e91cb0e1fdc755 (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
52
53
#!/bin/sh

# start/stop/restart/reload cfexecd

# 'cfexecd' may be used to capture cfagent output and send it as
# mail when run. All control parameters are set in cfagent.conf.
# cfagent can in turn start any other service (e.g. cfenvd, cfservd)

# Start cfexecd:
cfexecd_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 the CFEngine scheduler service:  /usr/sbin/cfexecd"
    /usr/sbin/cfexecd
  fi
}

# Stop cfexecd:
cfexecd_stop() {
  /bin/killall cfexecd 2> /dev/null
}

# Restart cfexecd:
cfexecd_restart() {
  cfexecd_stop
  sleep 1
  cfexecd_start
}

# Reload cfexecd:
cfexecd_reload() {
  /bin/killall -HUP cfexecd
}

case "$1" in
'start')
  cfexecd_start
  ;;
'stop')
  cfexecd_stop
  ;;
'restart')
  cfexecd_restart
  ;;
'reload')
  cfexecd_reload
  ;;
*)
  echo "usage $0 start|stop|restart|reload"
esac