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"
25 MASTERD_NAME="ganeti-masterd"
26 MASTERD="@PREFIX@/sbin/${MASTERD_NAME}"
27 MASTERD_PID="${GANETIRUNDIR}/${MASTERD_NAME}.pid"
29 RAPI_NAME="ganeti-rapi"
30 RAPI="@PREFIX@/sbin/${RAPI_NAME}"
31 RAPI_PID="${GANETIRUNDIR}/${RAPI_NAME}.pid"
33 SCRIPTNAME="@SYSCONFDIR@/init.d/ganeti"
35 test -f $NODED || exit 0
37 . /lib/lsb/init-functions
39 if [ -s $GANETI_DEFAULTS_FILE ]; then
40 . $GANETI_DEFAULTS_FILE
45 "@LOCALSTATEDIR@/lib/ganeti/server.pem"
47 if ! [ -f "$fname" ]; then
49 log_warning_msg "Config $fname not there, will not run."
62 log_action_end_msg 0 "not master"
65 log_action_end_msg 1 "exit code $RC"
71 # called as start_action daemon pidfile
72 local daemon="$1"; shift
73 local pidfile="$1"; shift
74 log_action_begin_msg "$daemon"
75 start-stop-daemon --start --quiet --exec "$daemon" --pidfile "$pidfile" \
81 # called as stop_action daemon pidfile
82 log_action_begin_msg "$1"
83 start-stop-daemon --stop --quiet --oknodo \
84 --retry 30 --pidfile "$2"
91 log_daemon_msg "Starting $DESC" "$NAME"
93 start_action $NODED $NODED_PID
94 start_action $MASTERD $MASTERD_PID
95 start_action $RAPI $RAPI_PID
98 log_daemon_msg "Stopping $DESC" "$NAME"
99 stop_action $RAPI $RAPI_PID
100 stop_action $MASTERD $MASTERD_PID
101 stop_action $NODED $NODED_PID
103 restart|force-reload)
104 log_daemon_msg "Reloading $DESC"
105 stop_action $RAPI $RAPI_PID
106 stop_action $MASTERD $MASTERD_PID
107 stop_action $NODED $NODED_PID
109 start_action $NODED $NODED_PID
110 start_action $MASTERD $MASTERD_PID
111 start_action $RAPI $RAPI_PID
114 log_success_msg "Usage: $SCRIPTNAME {start|stop|force-reload|restart}"