[Stgt-devel] [PATCH 1/2] Check if tgtd is running and has two process
Doron Shoham
dorons
Mon Apr 7 15:54:18 CEST 2008
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 <dorons at voltaire.com>
---
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
More information about the stgt
mailing list