summaryrefslogtreecommitdiff
path: root/system/salt/rc.salt-syndic.new
blob: c8986e21a2151ea65324281a77b04ccce538968a (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
#!/bin/sh
# Start/stop/restart salt syndic

PIDFILE=/var/run/salt-syndic.pid
LOGFILE=/var/log/salt/syndic
# LOGLEVEL: One of: all, garbage, trace, debug, info, warning, error, quiet
LOGLEVEL=warning

# Start salt-syndic:
salt_syndic_start() {
  if [ -x /usr/bin/salt-syndic ]; then
    echo "Starting salt-syndic daemon:  /usr/bin/salt-syndic"
    /usr/bin/salt-syndic -d \
      --pid-file=$PIDFILE \
      --log-file=$LOGFILE \
      --log-file-level=$LOGLEVEL
  fi
}

# Stop salt-syndic:
salt_syndic_stop() {
  if [ -s $PIDFILE ] ; then
    kill $(cat $PIDFILE)
  else
    killall salt-syndic
  fi
  rm -f $PIDFILE
}

# Restart salt-syndic:
salt_syndic_restart() {
  salt_syndic_stop
  sleep 1
  salt_syndic_start
}

case "$1" in
'start')
  salt_syndic_start
  ;;
'stop')
  salt_syndic_stop
  ;;
'restart')
  salt_syndic_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac