forked from choria-legacy/marionette-collective
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mcollective.init-rh
executable file
·128 lines (114 loc) · 2.53 KB
/
mcollective.init-rh
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/sh
#
# mcollective Application Server for STOMP based agents
#
# chkconfig: 345 24 76
#
# description: mcollective lets you build powerful Stomp compatible middleware clients in ruby without having to worry too
# much about all the setup and management of a Stomp connection, it also provides stats, logging and so forth
# as a bonus.
#
### BEGIN INIT INFO
# Provides: mcollective
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
RUBYLIB=/usr/local/lib/site_ruby/1.8:$RUBYLIB
export RUBYLIB
mcollectived="/usr/sbin/mcollectived"
# Lockfile
if [ -d /var/lock/subsys ]; then
# RedHat/CentOS/etc who use subsys
lock="/var/lock/subsys/mcollective"
else
# The rest of them
lock="/var/lock/mcollective"
fi
# PID directory
pidfile="/var/run/mcollectived.pid"
# Source function library.
. /etc/init.d/functions
# Check that binary exists
if ! [ -f $mcollectived ]
then
echo "mcollectived binary not found"
exit 0
fi
# See how we were called.
case "$1" in
start)
echo -n "Starting mcollective: "
if [ -f ${lock} ]; then
# we were not shut down correctly
if [ -s ${pidfile} ]; then
kill `cat ${pidfile}` >/dev/null 2>&1
fi
rm -f ${pidfile}
rm -f ${lock}
sleep 2
fi
rm -f ${pidfile}
${mcollectived} --pid=${pidfile} --config="/etc/mcollective/server.cfg"
if [ $? = 0 ]; then
success $"mcollectived"
touch $lock
echo
exit 0
else
failure
echo
exit 1
fi
;;
stop)
echo -n "Shutting down mcollective: "
if [ -s ${pidfile} ]; then
kill `cat ${pidfile}` >/dev/null 2>&1
fi
rm -f ${pidfile}
success $"mcollectived"
rm -f $lock
echo
;;
restart)
$0 stop
sleep 2
$0 start
;;
condrestart)
if [ -f $lock ]; then
$0 stop
# avoid race
sleep 2
$0 start
fi
;;
status)
if [ -f ${lock} ]; then
if [ -s ${pidfile} ]; then
if [ -e /proc/`cat ${pidfile}` ]; then
echo "mcollectived (`cat ${pidfile}`) is running"
exit 0
else
echo "mcollectived (`cat ${pidfile}`) is NOT running"
exit 1
fi
fi
else
echo "mcollectived: service not started"
exit 1
fi
;;
force-reload)
echo "not implemented"
;;
*)
echo "Usage: mcollectived {start|stop|restart|condrestart|status}"
exit 1
;;
esac
exit 0