updated on Tue Jan 10 00:10:07 UTC 2012
[aur-mirror.git] / salt-git / salt-minion
blob3e1fec4e426aba6b2643ff4a3c0e68837ae09f84
1 #!/bin/bash
3 daemon_name='salt-minion'
5 . /etc/rc.conf
6 . /etc/rc.d/functions
7 [ -f /etc/conf.d/$daemon_name ] && . /etc/conf.d/$daemon_name
9 get_pid() {
10 ps aux | grep -v grep | grep '/usr/bin/python2 /usr/bin/salt-minion' | awk '{print $2}'
13 case "$1" in
14 start)
15 stat_busy "Starting Salt Minion"
17 PID=$(get_pid)
18 if [ -z "$PID" ]; then
19 [ -f /var/run/$daemon_name.pid ] && rm -f /var/run/$daemon_name.pid
20 # RUN
21 /usr/bin/$daemon_name -d
23 if [ $? -gt 0 ]; then
24 stat_fail
25 exit 1
26 else
27 echo $(get_pid) > /var/run/$daemon_name.pid
28 add_daemon $daemon_name
29 stat_done
31 else
32 stat_fail
33 exit 1
37 stop)
38 stat_busy "Stopping Salt Minion"
39 PID=$(get_pid)
40 # KILL
41 [ ! -z "$PID" ] && kill $PID &> /dev/null
43 if [ $? -gt 0 ]; then
44 stat_fail
45 exit 1
46 else
47 rm -f /var/run/$daemon_name.pid &> /dev/null
48 rm_daemon $daemon_name
49 stat_done
53 restart)
54 $0 stop
55 sleep 1
56 $0 start
60 echo "usage: $0 {start|stop|restart|status}"
61 esac
63 exit 0