Merge "Update RPM-specs to 2013.2 version" into openstack-ci/build/havana
[openstack-build/cinder-build.git] / rpm / SOURCES / openstack-cinder-api.init
1 #!/bin/sh
2 #
3 # openstack-cinder-api  OpenStack cinder API Server
4 #
5 # chkconfig:   - 98 02
6 # description: At the heart of the cloud framework is an API Server. \
7 #              This API Server makes command and control of the      \
8 #              hypervisor, storage, and networking programmatically  \
9 #              available to users in realization of the definition   \
10 #              of cloud computing.
11
12 ### BEGIN INIT INFO
13 # Provides:
14 # Required-Start: $remote_fs $network $syslog
15 # Required-Stop: $remote_fs $syslog
16 # Default-Stop: 0 1 6
17 # Short-Description: OpenStack cinder API Server
18 # Description: At the heart of the cloud framework is an API Server.
19 #              This API Server makes command and control of the
20 #              hypervisor, storage, and networking programmatically
21 #              available to users in realization of the definition
22 #              of cloud computing.
23 ### END INIT INFO
24
25 . /etc/rc.d/init.d/functions
26
27 suffix=api
28 prog=openstack-cinder-$suffix
29 exec="/usr/bin/cinder-$suffix"
30 config="/etc/cinder/cinder.conf"
31 pidfile="/var/run/cinder/cinder-$suffix.pid"
32 logfile="/var/log/cinder/$suffix.log"
33
34 [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
35
36 lockfile=/var/lock/subsys/$prog
37
38 start() {
39     [ -x $exec ] || exit 5
40     [ -f $config ] || exit 6
41     echo -n $"Starting $prog: "
42     daemon --user cinder --pidfile $pidfile "$exec --config-file $config --logfile $logfile &>/dev/null & echo \$! > $pidfile"
43     retval=$?
44     echo
45     [ $retval -eq 0 ] && touch $lockfile
46     return $retval
47 }
48
49 stop() {
50     echo -n $"Stopping $prog: "
51     killproc -p $pidfile $prog
52     retval=$?
53     echo
54     [ $retval -eq 0 ] && rm -f $lockfile
55     return $retval
56 }
57
58 restart() {
59     stop
60     start
61 }
62
63 reload() {
64     restart
65 }
66
67 force_reload() {
68     restart
69 }
70
71 rh_status() {
72     status -p $pidfile $prog
73 }
74
75 rh_status_q() {
76     rh_status >/dev/null 2>&1
77 }
78
79
80 case "$1" in
81     start)
82         rh_status_q && exit 0
83         $1
84         ;;
85     stop)
86         rh_status_q || exit 0
87         $1
88         ;;
89     restart)
90         $1
91         ;;
92     reload)
93         rh_status_q || exit 7
94         $1
95         ;;
96     force-reload)
97         force_reload
98         ;;
99     status)
100         rh_status
101         ;;
102     condrestart|try-restart)
103         rh_status_q || exit 0
104         restart
105         ;;
106     *)
107         echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
108         exit 2
109 esac
110 exit $?