]> sourceware.org Git - lvm2.git/blame - scripts/cmirrord_init_red_hat.in
thin: tighten discard string conversions
[lvm2.git] / scripts / cmirrord_init_red_hat.in
CommitLineData
c9362fe8
JEB
1#!/bin/bash
2#
3# chkconfig: - 22 78
81410c8f 4# description: Starts and stops cmirrord
c9362fe8 5#
81410c8f 6# For Red-Hat-based distributions such as Fedora, RHEL, CentOS.
c9362fe8
JEB
7#
8### BEGIN INIT INFO
9# Provides: cmirrord
81410c8f
AK
10# Required-Start: $network $time $local_fs
11# Required-Stop: $network $time $local_fs
c9362fe8 12# Short-Description: Starts and stops cmirrord
81410c8f 13# Description: Starts and stops the cluster mirror log daemon
c9362fe8
JEB
14### END INIT INFO
15
16. /etc/init.d/functions
17
81410c8f
AK
18DAEMON=cmirrord
19
20LOCK_FILE="/var/lock/subsys/$DAEMON"
c9362fe8
JEB
21
22start()
23{
f25f57ae 24 rtrn=0
81410c8f
AK
25 if ! pidof $DAEMON > /dev/null
26 then
27 echo -n "Starting $DAEMON: "
9a2cde95 28 daemon $DAEMON
81410c8f
AK
29 rtrn=$?
30 echo
9a2cde95 31 fi
c9362fe8 32
81410c8f
AK
33 return $rtrn
34}
35
36stop()
37{
38 echo -n "Stopping $DAEMON:"
39 killproc $DAEMON -TERM
c9362fe8 40 rtrn=$?
9a2cde95 41 echo
7fef83d6 42
7fef83d6 43 return $rtrn
c9362fe8
JEB
44}
45
81410c8f 46wait_for_finish()
c9362fe8 47{
81410c8f
AK
48 count=0
49
50 while [ "$count" -le 10 -a -n "`pidof $DAEMON`" ]
51 do
7fef83d6 52 sleep 1
81410c8f 53 count=$((count + 1))
c9362fe8 54 done
81410c8f
AK
55
56 if [ `pidof $DAEMON` ]
57 then
7fef83d6 58 return 1
c9362fe8 59 else
81410c8f 60 return 0
c9362fe8 61 fi
c9362fe8
JEB
62}
63
64cmirror_status()
65{
81410c8f 66 status $DAEMON
c9362fe8
JEB
67}
68
69rtrn=1
70
71# See how we were called.
72case "$1" in
7fef83d6
JEB
73 start)
74 start
75 rtrn=$?
81410c8f 76 [ $rtrn = 0 ] && touch $LOCK_FILE
7fef83d6
JEB
77 ;;
78
79 stop)
80 stop
81 rtrn=$?
81410c8f 82 [ $rtrn = 0 ] && rm -f $LOCK_FILE
7fef83d6
JEB
83 ;;
84
85 restart)
81410c8f
AK
86 if stop
87 then
88 wait_for_finish
89 start
90 fi
7fef83d6
JEB
91 rtrn=$?
92 ;;
93
94 status)
95 cmirror_status
96 rtrn=$?
97 if [ $rtrn -eq 0 ]; then
98 echo "cmirror is running."
99 fi
100 ;;
101
102 *)
103 echo $"Usage: $0 {start|stop|restart|status}"
104 ;;
c9362fe8
JEB
105esac
106
107exit $rtrn
This page took 0.057458 seconds and 5 git commands to generate.