#!/bin/bash

nodeNr=all
group=$2
testName="NWSET2"
echo -n "Test $testName for $group on node $nodeNr "
out=$(timeout 10 ssh root@se01${group} ls /sapdb/programs /home/na${group#group}adm) 2>/dev/null; rc=$?

#
# now also checking node 2 ...
#
if [ $rc -eq 0 ]; then
	out=$(timeout 10 ssh root@se02${group} ls /sapdb/programs /home/na${group#group}adm) 2>/dev/null; rc=$?
fi

#echo "out: $out"
echo "rc:  $rc"
case $rc in 
    124 | 255 ) # test timeout - set N/A
         rm -f ./.status/${group}_${testName}_OK
         rm -f ./.status/${group}_${testName}_FAIL
         res="NA";
         ;;
    0  )
         touch ./.status/${group}_${testName}_OK
         rm -f ./.status/${group}_${testName}_FAIL
          ;;
    * )  rm -f ./.status/${group}_${testName}_OK
         touch ./.status/${group}_${testName}_FAIL
         ;;
esac
