[ofa-general] [PATCH] opensm/scripts/redhat-opensm.init: fix starting opensm when using daemon mode

Ira Weiny weiny2 at llnl.gov
Thu Jan 24 10:59:19 PST 2008


When daemon mode was specified this script was reporting "failure" on start
when it actually worked.  This fixes it by just waiting for a valid pid of
opensm.

Ira


>From 8f9b550c055b0fabf4c5fd6652060fae5dd7216b Mon Sep 17 00:00:00 2001
From: Ira K. Weiny <weiny2 at llnl.gov>
Date: Thu, 24 Jan 2008 10:51:23 -0800
Subject: [PATCH] opensm/scripts/redhat-opensm.init: fix starting opensm when using daemon mode


Signed-off-by: Ira K. Weiny <weiny2 at llnl.gov>
---
 opensm/scripts/redhat-opensm.init |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/opensm/scripts/redhat-opensm.init b/opensm/scripts/redhat-opensm.init
index 56dbb7c..3e00403 100755
--- a/opensm/scripts/redhat-opensm.init
+++ b/opensm/scripts/redhat-opensm.init
@@ -238,9 +238,19 @@ start()
 
 	echo -n "Starting IB Subnet Manager"
         echo $PORT_FLAG | $prog $START_FLAGS > /dev/null 2>&1 &
-        OSM_PID=$!
+        cnt=0; alive=0
+        while [ $cnt -lt 6 -a $alive -ne 1 ]; do
+		echo -n ".";
+		sleep 1
+		alive=0
+                OSM_PID=`pidof $prog`
+                if [ "$OSM_PID" != "" ]; then
+                        alive=1
+                fi
+		let cnt++;
+	done
+
         echo $OSM_PID > $PID_FILE
-	sleep 1
         checkpid $OSM_PID
         RC=$?
         [ $RC -eq 0 ] && echo_success || echo_failure
-- 
1.5.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-opensm-scripts-redhat-opensm.init-fix-starting-open.patch
Type: application/octet-stream
Size: 1177 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20080124/531cd86a/attachment.obj>


More information about the general mailing list