2015-05-09 02:59:18 +03:00
#!/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,
2016-01-21 13:49:46 +03:00
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2015-05-09 02:59:18 +03:00
#
# 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
2017-10-25 18:08:00 +03:00
sbindir="@SBINDIR@"
2015-05-09 02:59:18 +03:00
2017-10-25 18:08:00 +03:00
LOCK_FILE="@DEFAULT_LOCK_DIR@/subsys/$DAEMON"
2015-05-09 02:59:18 +03:00
PID_FILE="@LVMPOLLD_PIDFILE@"
rh_status() {
2017-10-25 18:02:31 +03:00
status -p "$PID_FILE" "$DAEMON"
2015-05-09 02:59:18 +03:00
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
start()
{
ret=0
2017-10-25 18:08:00 +03:00
action "Starting LVM poll daemon:" "$sbindir/$DAEMON" || ret=$?
2015-05-09 02:59:18 +03:00
return $ret
}
stop()
{
ret=0
2017-10-25 18:02:31 +03:00
action "Signaling LVM poll daemon to exit:" killproc -p "$PID_FILE" "$DAEMON" -TERM || ret=$?
return "$ret"
2015-05-09 02:59:18 +03:00
}
rtrn=1
# See how we were called.
case "$1" in
start)
rh_status_q && exit 0
start
rtrn=$?
2017-10-25 18:02:31 +03:00
[ $rtrn = 0 ] && touch "$LOCK_FILE"
2015-05-09 02:59:18 +03:00
;;
stop|force-stop)
rh_status_q || exit 0
stop
rtrn=$?
2017-10-25 18:02:31 +03:00
[ $rtrn = 0 ] && rm -f "$LOCK_FILE"
2015-05-09 02:59:18 +03:00
;;
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