Update RPM-specs to 2013.2 version
[openstack-build/cinder-build.git] / 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 pidfile="/var/run/cinder/cinder-$suffix.pid"
26 logfile="/var/log/cinder/$suffix.log"
27
28 [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
29
30 lockfile=/var/lock/subsys/$prog
31
32 start() {
33     [ -x $exec ] || exit 5
34     [ -f $config ] || exit 6
35     echo -n $"Starting $prog: "
36     daemon --user cinder --pidfile $pidfile "$exec --config-file $config --logfile $logfile &>/dev/null & echo \$! > $pidfile"
37     retval=$?
38     echo
39     [ $retval -eq 0 ] && touch $lockfile
40     return $retval
41 }
42
43 stop() {
44     echo -n $"Stopping $prog: "
45     killproc -p $pidfile $prog
46     retval=$?
47     echo
48     [ $retval -eq 0 ] && rm -f $lockfile
49     return $retval
50 }
51
52 restart() {
53     stop
54     start
55 }
56
57 reload() {
58     restart
59 }
60
61 force_reload() {
62     restart
63 }
64
65 rh_status() {
66     status -p $pidfile $prog
67 }
68
69 rh_status_q() {
70     rh_status >/dev/null 2>&1
71 }
72
73
74 case "$1" in
75     start)
76         rh_status_q && exit 0
77         $1
78         ;;
79     stop)
80         rh_status_q || exit 0
81         $1
82         ;;
83     restart)
84         $1
85         ;;
86     reload)
87         rh_status_q || exit 7
88         $1
89         ;;
90     force-reload)
91         force_reload
92         ;;
93     status)
94         rh_status
95         ;;
96     condrestart|try-restart)
97         rh_status_q || exit 0
98         restart
99         ;;
100     *)
101         echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
102         exit 2
103 esac
104 exit $?