improvs.
[anna.git] / example / diameter / launcher / deployments / st-client / checkStatus.sh
index ca132a8..fc14686 100755 (executable)
@@ -1,4 +1,5 @@
 #!/bin/bash
+# Result code: 1 (miss instances (and connections)), 2 (miss connections)
 ADML_CONNECTIONS=`cat .st_conf_adml_connections 2>/dev/null`
 ADML_INSTANCES=`cat .st_conf_adml_instances 2>/dev/null`
 RESULT_CODE=0
@@ -16,10 +17,10 @@ fi
 ADML_CONNECTIONS_ALIVE=$(netstat -a | grep :diameter | grep ESTABLISHED | wc -l)
 ADML_TOTAL_CONNECTIONS=$((ADML_CONNECTIONS*ADML_INSTANCES))
 echo -n "$ADML_CONNECTIONS_ALIVE connections established"
-if [ $ADML_CONNECTIONS_ALIVE -ne $ADML_TOTAL_CONNECTIONS ] && RESULT_CODE=1
+if [ $ADML_CONNECTIONS_ALIVE -ne $ADML_TOTAL_CONNECTIONS ]
 then
   echo " ! (expected $ADML_TOTAL_CONNECTIONS configured)"
-  RESULT_CODE=1
+  [ $RESULT_CODE -ne 1 ] && RESULT_CODE=
 else
   echo
 fi