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