Revision 8dbfc1b7 snf-ganeti-tools/conf/init.d/snf-ganeti-eventd
b/snf-ganeti-tools/conf/init.d/snf-ganeti-eventd | ||
---|---|---|
34 | 34 |
|
35 | 35 |
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" |
36 | 36 |
|
37 |
check_ganeti_master() { |
|
38 |
MASTER=`/usr/sbin/gnt-cluster getmaster` |
|
39 |
HOST=`/bin/hostname -f` |
|
40 |
|
|
41 |
if [ "x$MASTER" != x$HOST ]; then |
|
42 |
log_warning_msg "snf-ganeti-eventd should run on the ganeti master only, aborting start" |
|
43 |
log_end_msg 0 |
|
44 |
exit 0 |
|
45 |
fi |
|
46 |
} |
|
47 |
|
|
37 | 48 |
eventd_start() { |
38 | 49 |
if start-stop-daemon --start --chuid $SNF_USER --pidfile $SNF_EVENTD_PID_FILE \ |
39 | 50 |
--exec $DAEMON -- $SNF_EVENTD_OPTS |
... | ... | |
55 | 66 |
fi |
56 | 67 |
} # eventd_start |
57 | 68 |
|
58 |
MASTER=`/usr/sbin/gnt-cluster getmaster` |
|
59 |
HOST=`/bin/hostname -f` |
|
60 |
|
|
61 | 69 |
case "$1" in |
62 | 70 |
start) |
63 |
if [ "x$MASTER" != x$HOST ]; then |
|
64 |
log_warning_msg "snf-ganeti-eventd should run on the ganeti master only, aborting" |
|
65 |
log_end_msg 0 |
|
66 |
exit 0 |
|
67 |
fi |
|
71 |
# Check if we are on the Ganeti master node |
|
72 |
check_ganeti_master |
|
68 | 73 |
|
69 | 74 |
if "$SNF_EVENTD_ENABLE"; then |
70 | 75 |
log_daemon_msg "Starting snf-ganeti-eventd daemon" "snf-ganeti-eventd" |
... | ... | |
97 | 102 |
log_warning_msg "snf-ganeti-eventd daemon not running, attempting to start." |
98 | 103 |
rm -f $SNF_EVENTD_PID_FILE |
99 | 104 |
fi |
105 |
# Check if we are on the Ganeti master node, before starting |
|
106 |
check_ganeti_master |
|
100 | 107 |
eventd_start |
101 | 108 |
else |
102 | 109 |
if [ -s "$SNF_EVENTD_DEFAULTS" ]; then |
Also available in: Unified diff