2 # ganeti node daemon starter script
3 # based on skeleton from Debian GNU/Linux
6 # Required-Start: $syslog $remote_fs xend
7 # Required-Stop: $syslog $remote_fs xend
8 # Default-Start: 2 3 4 5
10 # Short-Description: Ganeti Xen Cluster Manager
11 # Description: Ganeti Xen Cluster Manager
14 PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
17 GANETIRUNDIR="@LOCALSTATEDIR@/run/ganeti"
19 GANETI_DEFAULTS_FILE="@SYSCONFDIR@/default/ganeti"
21 NODED_NAME="ganeti-noded"
22 NODED="@PREFIX@/sbin/${NODED_NAME}"
23 NODED_PID="${GANETIRUNDIR}/${NODED_NAME}.pid"
26 MASTERD_NAME="ganeti-masterd"
27 MASTERD="@PREFIX@/sbin/${MASTERD_NAME}"
28 MASTERD_PID="${GANETIRUNDIR}/${MASTERD_NAME}.pid"
31 RAPI_NAME="ganeti-rapi"
32 RAPI="@PREFIX@/sbin/${RAPI_NAME}"
33 RAPI_PID="${GANETIRUNDIR}/${RAPI_NAME}.pid"
36 SCRIPTNAME="@SYSCONFDIR@/init.d/ganeti"
38 test -f $NODED || exit 0
40 . /lib/lsb/init-functions
42 if [ -s $GANETI_DEFAULTS_FILE ]; then
43 . $GANETI_DEFAULTS_FILE
48 "@LOCALSTATEDIR@/lib/ganeti/server.pem"
50 if ! [ -f "$fname" ]; then
52 log_warning_msg "Config $fname not there, will not run."
65 log_action_end_msg 0 "not master"
68 log_action_end_msg 1 "exit code $RC"
74 # called as start_action daemon pidfile
75 local daemon="$1"; shift
76 local pidfile="$1"; shift
77 log_action_begin_msg "$daemon"
78 start-stop-daemon --start --quiet --exec "$daemon" --pidfile "$pidfile" \
84 # called as stop_action daemon pidfile
85 log_action_begin_msg "$1"
86 start-stop-daemon --stop --quiet --oknodo \
87 --retry 30 --pidfile "$2"
94 log_daemon_msg "Starting $DESC" "$NAME"
96 start_action $NODED $NODED_PID $NODED_ARGS
97 start_action $MASTERD $MASTERD_PID $MASTERD_ARGS
98 start_action $RAPI $RAPI_PID $RAPI_ARGS
101 log_daemon_msg "Stopping $DESC" "$NAME"
102 stop_action $RAPI $RAPI_PID
103 stop_action $MASTERD $MASTERD_PID
104 stop_action $NODED $NODED_PID
106 restart|force-reload)
107 log_daemon_msg "Reloading $DESC"
108 stop_action $RAPI $RAPI_PID
109 stop_action $MASTERD $MASTERD_PID
110 stop_action $NODED $NODED_PID
112 start_action $NODED $NODED_PID
113 start_action $MASTERD $MASTERD_PID
114 start_action $RAPI $RAPI_PID
117 log_success_msg "Usage: $SCRIPTNAME {start|stop|force-reload|restart}"