Files
openNDS/testing/ndsctl-testing/ndsctlstatus.sh
2021-06-26 08:51:04 +01:00

33 lines
534 B
Bash
Executable File

#!/bin/sh
#Copyright (C) BlueWave Projects and Services 2015-2021
do_ndsctl () {
for tic in $(seq $timeout); do
ndsstatus="ready"
ndsctlout=$(ndsctl $ndsctlcmd)
ret=$?
if [ $ret = "0" ]; then
ndsstatus=$(echo "$ndsctlout" | grep "Version")
break
elif [ $ret = "4" ]; then
ndsstatus="busy"
sleep 1
continue
else
ndsstatus="failed"
break
fi
done
return $ret
}
iteration=$1
timeout=2
ndsctlcmd="status"
do_ndsctl
echo "Iteration: $iteration, Return Code: $ret, Return Value: $ndsstatus"
exit 0