]> git.pld-linux.org Git - packages/ganeti.git/blame - ganeti-rapi.init
- new BR
[packages/ganeti.git] / ganeti-rapi.init
CommitLineData
bc935a7a
JR
1#!/bin/sh
2#
3# ganeti-rapi Start/Stop Ganeti Cluster remote API daemon
4#
5# chkconfig: 2345 98 02
6# description: Ganeti Cluster remote API daemon
7#
8# processname: ganeti-rapi
9# pidfile: /var/run/ganeti/ganeti-rapi.pid
10#
11### BEGIN INIT INFO
12# Provides: ganeti-rapi
13# Required-Start: $syslog $remote_fs
14# Required-Stop: $syslog $remote_fs
15# Default-Start: 2 3 4 5
16# Default-Stop: 0 1 6
17# Short-Description: Ganeti Cluster remote API daemon
18# Description: Ganeti Cluster remote API daemon
19### END INIT INFO
20
21# Source function library.
22. /etc/rc.d/init.d/functions
23
24_ARGS=""
25
26# Get service config
27[ -f /etc/sysconfig/ganeti ] && . /etc/sysconfig/ganeti
28
29if [ ! -f /var/lib/ganeti/server.pem ]; then
30 echo "Missing configuration file /var/lib/ganeti/server.pem"
31 exit 1
32fi
33
34start() {
35 # Check if the service is already running?
36 if [ -f /var/lock/subsys/ganeti-rapi ]; then
37 msg_already_running "Ganeti Cluster remote API daemon"
38 return
39 fi
40
41 msg_starting "Ganeti Cluster remote API daemon"
4a9e23c9 42 @LIBDIR@/ganeti/ensure-dirs
848d0038 43 daemon --pidfile /var/run/ganeti/ganeti-rapi.pid /usr/sbin/ganeti-rapi $_ARGS
bc935a7a
JR
44 RETVAL=$?
45 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ganeti-rapi
46}
47
48stop() {
49 if [ ! -f /var/lock/subsys/ganeti-rapi ]; then
50 msg_not_running "Ganeti Cluster remote API daemon"
51 return
52 fi
53
54 msg_stopping "Ganeti Cluster remote API daemon"
55 killproc --pidfile /var/run/ganeti/ganeti-rapi.pid ganeti-rapi
56 rm -f /var/lock/subsys/ganeti-rapi
57}
58
59# HUP causes daemon to reopen logs only
60reload() {
61 if [ ! -f /var/lock/subsys/ganeti-rapi ]; then
62 msg_not_running "Ganeti Cluster remote API daemon"
63 RETVAL=7
64 return
65 fi
66
67 msg_reloading "Ganeti Cluster remote API daemon"
68 killproc ganeti-rapi -HUP
69 RETVAL=$?
70}
71
72condrestart() {
73 if [ ! -f /var/lock/subsys/ganeti-rapi ]; then
74 msg_not_running "Ganeti Cluster remote API daemon"
75 RETVAL=$1
76 return
77 fi
78
79 stop
80 start
81}
82
83RETVAL=0
84# See how we were called.
85case "$1" in
86 start)
87 start
88 ;;
89 stop)
90 stop
91 ;;
92 restart)
93 stop
94 start
95 ;;
96 try-restart)
97 condrestart 0
98 ;;
99 reload|force-reload|flush-logs)
100 reload
101 ;;
102 status)
103 status --pidfile /var/run/ganeti/ganeti-rapi.pid ganeti-rapi
104 exit $?
105 ;;
106 *)
107 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|flush-logs|status}"
108 exit 3
109esac
110
111exit $RETVAL
This page took 0.072696 seconds and 4 git commands to generate.