#!/bin/sh #---------------------------------------------------------------------------- # /etc/init.d/lvm-monitor - lvm-monitor start script # # Creation : 2009-04-21 holbru # Last update: $Id$ # # Copyright (c) 2001-@@YEAR@@ the eisfair team, team(at)eisfair(dot)org> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- # # ln -s /etc/init.d/lvm-monitor /etc/rc2.d/S05clvm-monitor # ln -s /etc/init.d/lvm-monitor /etc/rc2.d/K95alvm-monitor # . /etc/init.d/functions DAEMON=lvm-monitor exec_prefix=/usr sbindir=/usr/sbin VGCHANGE=${sbindir}/vgchange VGS=${sbindir}/vgs LOCK_FILE="/var/lock/subsys/${DAEMON}" # --------------------------------------------------------------------------- # usage # --------------------------------------------------------------------------- usage() { cat < /dev/null) for vg in ${VGSLIST} do boot_mesg " * Starting monitoring for VG ${vg}:" loadproc ${VGCHANGE} --monitor y --poll y ${vg} ret=${?} done return ${ret} fi } # --------------------------------------------------------------------------- # stop lvm-monitor # --------------------------------------------------------------------------- lvm_monitor_stop() { if [ -f "${LOCK_FILE}" ] then ret=0 # TODO do we want to separate out already active groups only? VGSLIST=$(${VGS} --noheadings -o name 2> /dev/null) for vg in ${VGSLIST} do boot_mesg " *Stopping monitoring for VG ${vg}:" loadproc ${VGCHANGE} --monitor n ${vg} ret=${?} done return ${ret} fi } # --------------------------------------------------------------------------- # main # --------------------------------------------------------------------------- rtrn=1 while [ "${#}" -gt 0 ] do case "${1}" in -q|--quiet) _quiet=true shift ;; *) _action="${1}" shift ;; esac done case "${_action}" in start) lvm_monitor_start rtrn=${?} if [ ${rtrn:-1} -eq 0 ] then touch ${LOCK_FILE} fi ;; stop) lvm_monitor_stop rtrn=${?} if [ ${rtrn:-1} -eq 0 ] then rm -f ${LOCK_FILE} fi ;; restart) if lvm_monitor_stop then lvm_monitor_start fi rtrn=${?} ;; *) usage ;; esac exit ${rtrn} # --------------------------------------------------------------------------- # end # ---------------------------------------------------------------------------