File: lvm2_lvmpolld_init_red_hat.in

package info (click to toggle)
lvm2 2.03.31-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie, trixie-proposed-updates, trixie-updates
  • size: 15,920 kB
  • sloc: ansic: 180,675; sh: 42,231; python: 6,554; makefile: 2,079; cpp: 1,258; ruby: 66; awk: 20
file content (112 lines) | stat: -rw-r--r-- 2,297 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/bash
#
# Copyright (C) 2015 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
# This file is part of LVM2.
# It is required for the proper handling of failures of LVM2 mirror
# devices that were created using the -m option of lvcreate.
#
#
# chkconfig: 12345 02 99
# description: Starts and stops LVM poll daemon
#
# For Red-Hat-based distributions such as Fedora, RHEL, CentOS.
#
### BEGIN INIT INFO
# Provides: lvm2-lvmpolld
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 1 2 3 4 5
# Default-Stop: 0 6
# Short-Description: A daemon that is responsible for monitoring in-progress
#		     and possibly longer term operations on logical volumes. 
#		     It helps to reduce the number of spawned processes if same
#                    logical volume is requested to get monitored multiple times.
#                    Also avoids unsolicited termination due to external factors.
### END INIT INFO

. /etc/init.d/functions

DAEMON=lvmpolld

sbindir="@SBINDIR@"

LOCK_FILE="@DEFAULT_LOCK_DIR@/subsys/$DAEMON"
PID_FILE="@LVMPOLLD_PIDFILE@"

rh_status() {
	status -p "$PID_FILE" "$DAEMON"
}

rh_status_q() {
	rh_status >/dev/null 2>&1
}

start()
{
	ret=0
	action "Starting LVM poll daemon:" "$sbindir/$DAEMON" || ret=$?
	return $ret
}

stop()
{
	ret=0
	action "Signaling LVM poll daemon to exit:" killproc -p "$PID_FILE" "$DAEMON" -TERM || ret=$?
	return "$ret"
}

rtrn=1

# See how we were called.
case "$1" in
  start)
	rh_status_q && exit 0
	start
	rtrn=$?
	[ $rtrn = 0 ] && touch "$LOCK_FILE"
	;;

  stop|force-stop)
	rh_status_q || exit 0
	stop
	rtrn=$?
	[ $rtrn = 0 ] && rm -f "$LOCK_FILE"
	;;

  restart)
	if stop
	then
		start
	fi
	rtrn=$?
	;;

  condrestart|try-restart)
	rh_status_q || exit 0
	if stop
	then
		start
	fi
	rtrn=$?
	;;

  status)
	rh_status
	rtrn=$?
	;;

  *)
	echo $"Usage: $0 {start|stop|force-stop|restart|condrestart|try-restart|status}"
	;;
esac

exit $rtrn