WIP: fixing script, broken

This commit is contained in:
Jed Reynolds
2020-06-18 17:32:35 -07:00
parent a7610bcae3
commit ee133c7d7e

View File

@@ -13,26 +13,28 @@ GUIDIR="${HL}/LANforgeGUI_${verNum}"
ST="/tmp/summary.txt" ST="/tmp/summary.txt"
IP="192.168.95.239" IP="192.168.95.239"
numFound=$(find ${GUIDIR} -name down-check -mmin 60 | grep -c down-check) if [ -f ${GUIDIR}/down-check ]; then
if [[ $numFound == 1 ]]; then numFound=`find ${GUIDIR} -name down-check -mmin +59 | grep -c down-check`
ping -c2 -i1 -nq -w2 -W2 ${IP}
if [[ 1 != $? ]]; then if (( numFound >= 1 )); then
touch "${GUIDIR}/down-check" ping -c2 -i1 -nq -w4 -W8 ${IP}
echo "Could not connect to ${IP}" if (( 0 == $? )); then
exit 1
else
rm "${GUIDIR}/down-check" rm "${GUIDIR}/down-check"
fi else
else
ping -c2 -i1 -nq -w2 -W2 ${IP}
if [[ 1 != $? ]]; then
touch "${GUIDIR}/down-check" touch "${GUIDIR}/down-check"
echo "Could not connect to ${IP}" echo "Could not connect to ${IP}"
exit 1 exit 1
fi fi
else
ping -c2 -i1 -nq -w4 -W4 ${IP}
if (( 0 != $? )); then
touch "${GUIDIR}/down-check"
echo "Could not connect to ${IP}"
exit 1
fi
fi
fi fi
rm -f /tmp/*.txt rm -f /tmp/*.txt
rm -f $GUILog $GUIUpdate $CTLGUI $CTLH $ST rm -f $GUILog $GUIUpdate $CTLGUI $CTLH $ST