-
Notifications
You must be signed in to change notification settings - Fork 18
/
openstack-nova-api.init
executable file
·127 lines (118 loc) · 2.83 KB
/
openstack-nova-api.init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/bin/bash
#
# nova-api OpenStack Nova API Server
#
# chkconfig: 2345 96 04
# description: At the heart of the cloud framework is an API Server. \
# This API Server makes command and control of the \
# hypervisor, storage, and networking programmatically \
# available to users in realization of the definition \
# of cloud computing.
#
# config: /etc/nova/nova.conf
# config: /etc/nova/nova-api.conf
# pidfile: /var/run/nova/nova-api.pid
### BEGIN INIT INFO
# Provides: openstack-nova-api
# Required-Start: $local_fs $network $syslog
# Required-Stop: $local_fs $syslog
# Should-Start: $syslog
# Should-Stop: $network $syslog
# Default-Start: 3 4 5
# Default-Stop: 0 2 1 6
# Short-Description: OpenStack Nova API Server
# Description: At the heart of the cloud framework is an API Server.
# This API Server makes command and control of the
# hypervisor, storage, and networking programmatically
# available to users in realization of the definition
# of cloud computing.
### END INIT INFO
# Source function library.
. /etc/init.d/functions
prog="OpenStack Nova API Server"
suffix="api"
flgfile=/etc/nova/nova.conf
logfile=/var/log/nova/nova-$suffix.log
pidfile=/var/run/nova/nova-$suffix.pid
lckfile=/var/lock/subsys/openstack-nova-$suffix
binfile=/usr/bin/nova-$suffix
start() {
if [ -f "$pidfile" ]; then
pid=`cat $pidfile`
checkpid $pid
r=$?
if [ "$r" -eq 0 ]; then
cmd=$(basename $binfile)
echo -n "$cmd is already running (pid $pid)"; passed
echo
exit 0
fi
fi
echo -n "Starting $prog: "
cd /var/lib/nova
/sbin/start-stop-daemon --start -b -c nova:nobody --make-pidfile --pidfile $pidfile --exec /usr/bin/nova-$suffix -- --flagfile=$flgfile --logfile=$logfile --pidfile $pidfile
sleep 1
if [ -f "$pidfile" ]; then
checkpid `cat $pidfile`
r=$?
if [ "$r" -eq 0 ]; then
touch $lckfile
success
else
failure
fi
else
failure
fi
echo
return
}
stop() {
echo -n "Stopping $prog: "
if [ -n "`pidofproc -p $pidfile $binfile`" ] ; then
killproc $pidfile
#dirty fix. old script do not kill all processes
killproc $binfile
else
failure $"Stopping $prog"
fi
retval=$?
[ $retval -eq 0 ] && rm -f $lckfile
echo
return $retval
}
rh_status() {
status -p $pidfile $binfile
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
rh_status
retval=$?
if [ $retval -eq 3 -a -f $lckfile ] ; then
retval=2
fi
;;
restart)
restart
;;
condrestart)
if [ -n "`pidofproc -p $pidfile $binfile`" ] ; then
restart
fi
;;
*)
echo "Usage: service openstack-nova-$suffix {start|stop|status|restart|condrestart}"
exit 1
;;
esac
exit $?