[DRBD-cvs] svn commit by phil - r2010 - branches/drbd-0.7/scripts -
drbddisk RESOURCE status used to report "stopped" even
drbd-cvs at lists.linbit.com
drbd-cvs at lists.linbit.com
Tue Nov 22 11:24:36 CET 2005
Author: phil
Date: 2005-11-22 11:24:36 +0100 (Tue, 22 Nov 2005)
New Revision: 2010
Modified:
branches/drbd-0.7/scripts/drbddisk
Log:
drbddisk RESOURCE status used to report "stopped" even if the
resource was not defined in the config.
Fixed that.
Modified: branches/drbd-0.7/scripts/drbddisk
===================================================================
--- branches/drbd-0.7/scripts/drbddisk 2005-11-19 09:15:19 UTC (rev 2009)
+++ branches/drbd-0.7/scripts/drbddisk 2005-11-22 10:24:36 UTC (rev 2010)
@@ -23,9 +23,9 @@
case "$CMD" in
start)
- # try several times, in case heartbeat deadtime
+ # try several times, in case heartbeat deadtime
# was smaller than drbd ping time
- try=6
+ try=6
while true; do
$DRBDADM primary $RES && break
let "--try" || exit 20
@@ -33,21 +33,23 @@
done
;;
stop)
- # exec, so the exit code of drbdadm propagates
+ # exec, so the exit code of drbdadm propagates
exec $DRBDADM secondary $RES
;;
status)
if [ "$RES" = "all" ]; then
echo "A resource name is required for status inquiries."
exit 10
- fi
- ST=$( $DRBDADM state $RES 2> /dev/null )
- ST=${ST%/*}
- if [ "$ST" = "Primary" ]; then
+ fi
+ ST=$( $DRBDADM state $RES 2>&1 )
+ STATE=${ST%/*}
+ if [ "$STATE" = "Primary" ]; then
echo "running"
+ elif [ "$STATE" = "Secondary" ]; then
+ echo "stopped"
else
- echo "stopped"
- fi
+ echo "$ST"
+ fi
;;
*)
echo "Usage: drbddisk [resource] {start|stop|status}"
More information about the drbd-cvs
mailing list