Check if tgtd is running and has two process.
If not, the script will exit and not try
to start tgtd itself.

Signed-off-by: Doron Shoham <[EMAIL PROTECTED]>
---
 scripts/tgt-setup-lun |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/scripts/tgt-setup-lun b/scripts/tgt-setup-lun
index 53bb934..6fb6626 100755
--- a/scripts/tgt-setup-lun
+++ b/scripts/tgt-setup-lun
@@ -154,10 +154,11 @@ initiators=$*
 verify_params
 
 # Check if tgtd is running (we should have 2 daemons)
-tgtd_count=$(ps aux|grep -c tgtd)
-if [ $tgtd_count -ne 3 ]; then
-       echo "Starting tgtd"
-       tgtd
+tgtd_count=`pidof tgtd | wc -w`
+if [ $tgtd_count -ne 2 ]; then
+       echo "tgtd is not running"
+       echo "Exiting..."
+       exit 1
 fi
 
 tgt_name="iqn.2001-04.com.$(hostname -s)-$tgt_name"
-- 
1.5.2


_______________________________________________
Stgt-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/stgt-devel

Reply via email to