]> git.pld-linux.org Git - packages/ganeti.git/blame - ganeti-rapi.init
- added systemd support
[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"
42 daemon --user USER --pidfile /var/run/ganeti/ganeti-rapi.pid /usr/sbin/ganeti-rapi $_ARGS
43 RETVAL=$?
44 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ganeti-rapi
45}
46
47stop() {
48 if [ ! -f /var/lock/subsys/ganeti-rapi ]; then
49 msg_not_running "Ganeti Cluster remote API daemon"
50 return
51 fi
52
53 msg_stopping "Ganeti Cluster remote API daemon"
54 killproc --pidfile /var/run/ganeti/ganeti-rapi.pid ganeti-rapi
55 rm -f /var/lock/subsys/ganeti-rapi
56}
57
58# HUP causes daemon to reopen logs only
59reload() {
60 if [ ! -f /var/lock/subsys/ganeti-rapi ]; then
61 msg_not_running "Ganeti Cluster remote API daemon"
62 RETVAL=7
63 return
64 fi
65
66 msg_reloading "Ganeti Cluster remote API daemon"
67 killproc ganeti-rapi -HUP
68 RETVAL=$?
69}
70
71condrestart() {
72 if [ ! -f /var/lock/subsys/ganeti-rapi ]; then
73 msg_not_running "Ganeti Cluster remote API daemon"
74 RETVAL=$1
75 return
76 fi
77
78 stop
79 start
80}
81
82RETVAL=0
83# See how we were called.
84case "$1" in
85 start)
86 start
87 ;;
88 stop)
89 stop
90 ;;
91 restart)
92 stop
93 start
94 ;;
95 try-restart)
96 condrestart 0
97 ;;
98 reload|force-reload|flush-logs)
99 reload
100 ;;
101 status)
102 status --pidfile /var/run/ganeti/ganeti-rapi.pid ganeti-rapi
103 exit $?
104 ;;
105 *)
106 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|flush-logs|status}"
107 exit 3
108esac
109
110exit $RETVAL
This page took 0.043001 seconds and 4 git commands to generate.