Add python-cinder package to MOS 8.0 repository
[openstack-build/cinder-build.git] / rpm / SOURCES / openstack-cinder-volume.init
1 #!/bin/sh
2 #
3 # openstack-cinder-volume  OpenStack cinder Volume Worker
4 #
5 # chkconfig:   - 98 02
6 # description:  Volume Workers interact with iSCSI storage to manage    \
7 #               LVM-based instance volumes. Specific functions include: \
8 #               * Create Volumes                                        \
9 #               * Delete Volumes                                        \
10 #               * Establish Compute volumes
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 Volume Worker
18 # Description:  Volume Workers interact with iSCSI storage to manage
19 #               LVM-based instance volumes. Specific functions include:
20 #               * Create Volumes
21 #               * Delete Volumes
22 #               * Establish Compute volumes
23 ### END INIT INFO
24
25 . /etc/rc.d/init.d/functions
26
27 suffix=volume
28 prog=openstack-cinder-$suffix
29 exec="/usr/bin/cinder-$suffix"
30 config="/etc/cinder/cinder.conf"
31 distconfig="/usr/share/cinder/cinder-dist.conf"
32 pidfile="/var/run/cinder/cinder-$suffix.pid"
33 logfile="/var/log/cinder/$suffix.log"
34
35 [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
36
37 lockfile=/var/lock/subsys/$prog
38
39 start() {
40     [ -x $exec ] || exit 5
41     [ -f $config ] || exit 6
42     echo -n $"Starting $prog: "
43     daemon --user cinder --pidfile $pidfile "$exec --config-file $distconfig --config-file $config --logfile $logfile &>/dev/null & echo \$! > $pidfile"
44     retval=$?
45     echo
46     [ $retval -eq 0 ] && touch $lockfile
47     return $retval
48 }
49
50 stop() {
51     echo -n $"Stopping $prog: "
52     killproc -p $pidfile $prog
53     retval=$?
54     echo
55     [ $retval -eq 0 ] && rm -f $lockfile
56     return $retval
57 }
58
59 restart() {
60     stop
61     start
62 }
63
64 reload() {
65     restart
66 }
67
68 force_reload() {
69     restart
70 }
71
72 rh_status() {
73     status -p $pidfile $prog
74 }
75
76 rh_status_q() {
77     rh_status >/dev/null 2>&1
78 }
79
80
81 case "$1" in
82     start)
83         rh_status_q && exit 0
84         $1
85         ;;
86     stop)
87         rh_status_q || exit 0
88         $1
89         ;;
90     restart)
91         $1
92         ;;
93     reload)
94         rh_status_q || exit 7
95         $1
96         ;;
97     force-reload)
98         force_reload
99         ;;
100     status)
101         rh_status
102         ;;
103     condrestart|try-restart)
104         rh_status_q || exit 0
105         restart
106         ;;
107     *)
108         echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
109         exit 2
110 esac
111 exit $?