summaryrefslogtreecommitdiffstats
path: root/scripts/lvm2_lvmetad_init_red_hat.in
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2012-02-24 13:03:50 +0000
committerPeter Rajnoha <prajnoha@redhat.com>2012-02-24 13:03:50 +0000
commita30491b25f91bcfaac5f12c4a833389eaab6955a (patch)
tree518d58f4e97d00489f8b2fc4429d1e47c688bda1 /scripts/lvm2_lvmetad_init_red_hat.in
parent32c84c8f3de1b846c7c029a196d03fdf90219fd1 (diff)
downloadlvm2-a30491b25f91bcfaac5f12c4a833389eaab6955a.tar.gz
lvm2-a30491b25f91bcfaac5f12c4a833389eaab6955a.tar.xz
lvm2-a30491b25f91bcfaac5f12c4a833389eaab6955a.zip
Add LVMetaD init script.
Diffstat (limited to 'scripts/lvm2_lvmetad_init_red_hat.in')
-rw-r--r--scripts/lvm2_lvmetad_init_red_hat.in113
1 files changed, 113 insertions, 0 deletions
diff --git a/scripts/lvm2_lvmetad_init_red_hat.in b/scripts/lvm2_lvmetad_init_red_hat.in
new file mode 100644
index 00000000..867391df
--- /dev/null
+++ b/scripts/lvm2_lvmetad_init_red_hat.in
@@ -0,0 +1,113 @@
+#!/bin/bash
+#
+# Copyright (C) 2012 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 metadata daemon
+#
+# For Red-Hat-based distributions such as Fedora, RHEL, CentOS.
+#
+### BEGIN INIT INFO
+# Provides: lvm2-lvmetad
+# Required-Start: $local_fs
+# Required-Stop: $local_fs
+# Default-Start: 1 2 3 4 5
+# Default-Stop: 0 6
+# Short-Description: A daemon that maintains LVM metadata state for improved
+# performance by avoiding further scans while running
+# subsequent LVM commands or while using lvm2app library.
+### END INIT INFO
+
+. /etc/init.d/functions
+
+DAEMON=lvmetad
+
+exec_prefix=@exec_prefix@
+sbindir=@sbindir@
+
+lvm_vgscan=${sbindir}/vgscan
+
+LOCK_FILE="/var/lock/subsys/$DAEMON"
+
+
+rh_status() {
+ status $DAEMON
+}
+
+rh_status_q() {
+ rh_status >/dev/null 2>&1
+}
+
+start()
+{
+ ret=0
+ action "Starting LVM metadata daemon:" $DAEMON || ${lvm_vgscan} || ret=$?
+ return $ret
+}
+
+
+stop()
+{
+ ret=0
+ action "Signaling LVM metadata daemon to exit:" kill -TERM $(pidofproc $DAEMON) || 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)
+ status $DAEMON
+ ;;
+
+ *)
+ echo $"Usage: $0 {start|stop|force-stop|restart|condrestart|try-restart|status}"
+ ;;
+esac
+
+exit $rtrn