From 2f225ca40573d6d721475650ca34f805dc64c21d Mon Sep 17 00:00:00 2001 From: Doug Ledford Date: Mon, 16 May 2005 22:03:20 +0000 Subject: [PATCH] Fix/cleanup mdmonitor init script --- mdadm.spec | 8 ++++++-- mdmonitor.init | 22 ++++++---------------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/mdadm.spec b/mdadm.spec index 8283785..cf65cf3 100644 --- a/mdadm.spec +++ b/mdadm.spec @@ -1,7 +1,7 @@ Summary: mdadm controls Linux md devices (software RAID arrays) Name: mdadm Version: 1.11.0 -Release: 3.fc4 +Release: 4.fc4 Source: http://www.cse.unsw.edu.au/~neilb/source/mdadm/mdadm-%{version}.tgz Source1: mdmonitor.init Source2: mdmpd-0.4.tgz @@ -81,12 +81,16 @@ fi %attr(0700,root,root) %dir /var/run/mdadm %changelog +* Mon May 16 2005 Doug Ledford 1.11.0-4.fc4 +- Make the mdmonitor init script use the pid-file option, major cleanup + of the script now possible (#134459) + * Mon May 16 2005 Doug Ledford 1.11.0-3.fc4 - Put back the obsoletes: raidtools that was present in 1.11.0-1.fc4 * Mon May 16 2005 Doug Ledford 1.11.0-2.fc4 - Change the default auto= mode so it need not be on the command line to - work with udev, however it is still supported on the command line. + work with udev, however it is still supported on the command line (#132706) - Add a man page (from Luca Berra) for mdassemble * Wed May 11 2005 Doug Ledford - 1.11.0-1.fc4 diff --git a/mdmonitor.init b/mdmonitor.init index 23eb21f..2897d20 100755 --- a/mdmonitor.init +++ b/mdmonitor.init @@ -12,6 +12,7 @@ PATH=/sbin:/usr/sbin:$PATH RETVAL=0 +OPTIONS="--monitor --scan -f --pid-file=/var/run/mdadm/mdadm.pid" prog=mdmonitor @@ -33,31 +34,20 @@ usage () start () { - ulimit -S -c 0 >/dev/null 2>&1 echo -n $"Starting $prog: " - daemon --check mdadm --user=root \ - "/bin/bash -c \"mdadm --monitor --scan -f > /var/run/mdadm/mdadm.pid\"" - # hack: wait for mdadm to die, assume success if it doesn't die quickly - usleep 100000 - if [ -s /var/run/mdadm/mdadm.pid -a -d /proc/$(cat /var/run/mdadm/mdadm.pid) ] ; then - success $"mdadm" - RETVAL=0 - touch /var/lock/subsys/$prog - else - failure $"mdadm" - rm -f /var/run/mdadm/mdadm.pid - rm -f /var/lock/subsys/$prog - RETVAL=1 - fi + daemon --check --user=root mdadm ${OPTIONS} + ret=$? + [ $ret -eq "0" ] && touch /var/lock/subsys/$prog echo + return $ret } stop () { + [ -f /var/lock/subsys/$prog ] || return 0 echo -n "Killing $prog: " killproc mdadm echo - rm -f /var/run/mdadm/mdadm.pid rm -f /var/lock/subsys/$prog }