Move cinder to 8.0 branch
[openstack-build/cinder-build.git] / centos7 / rpm / SOURCES / openstack-cinder-scheduler.init
1 #!/bin/sh
2 #
3 # openstack-cinder-scheduler  OpenStack cinder Scheduler
4 #
5 # chkconfig:   - 98 02
6 # description: Determines which physical hardware to allocate to a virtual resource
7
8 ### BEGIN INIT INFO
9 # Provides:
10 # Required-Start: $remote_fs $network $syslog
11 # Required-Stop: $remote_fs $syslog
12 # Default-Stop: 0 1 6
13 # Short-Description: OpenStack cinder Scheduler
14 # Description: Determines which physical hardware to allocate to a virtual resource
15 ### END INIT INFO
16
17 . /etc/rc.d/init.d/functions
18
19 suffix=scheduler
20 prog=openstack-cinder-$suffix
21 exec="/usr/bin/cinder-$suffix"
22 config="/etc/cinder/cinder.conf"
23 distconfig="/usr/share/cinder/cinder-dist.conf"
24 pidfile="/var/run/cinder/cinder-$suffix.pid"
25 logfile="/var/log/cinder/$suffix.log"
26
27 [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
28
29 lockfile=/var/lock/subsys/$prog
30
31 start() {
32     [ -x $exec ] || exit 5
33     [ -f $config ] || exit 6
34     echo -n $"Starting $prog: "
35     daemon --user cinder --pidfile $pidfile "$exec --config-file $distconfig --config-file $config --logfile $logfile &>/dev/null & echo \$! > $pidfile"
36     retval=$?
37     echo
38     [ $retval -eq 0 ] && touch $lockfile
39     return $retval
40 }
41
42 stop() {
43     echo -n $"Stopping $prog: "
44     killproc -p $pidfile $prog
45     retval=$?
46     echo
47     [ $retval -eq 0 ] && rm -f $lockfile
48     return $retval
49 }
50
51 restart() {
52     stop
53     start
54 }
55
56 reload() {
57     restart
58 }
59
60 force_reload() {
61     restart
62 }
63
64 rh_status() {
65     status -p $pidfile $prog
66 }
67
68 rh_status_q() {
69     rh_status >/dev/null 2>&1
70 }
71
72
73 case "$1" in
74     start)
75         rh_status_q && exit 0
76         $1
77         ;;
78     stop)
79         rh_status_q || exit 0
80         $1
81         ;;
82     restart)
83         $1
84         ;;
85     reload)
86         rh_status_q || exit 7
87         $1
88         ;;
89     force-reload)
90         force_reload
91         ;;
92     status)
93         rh_status
94         ;;
95     condrestart|try-restart)
96         rh_status_q || exit 0
97         restart
98         ;;
99     *)
100         echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
101         exit 2
102 esac
103 exit $?