Another IAmNotAJeep_and_Maxximus007_WATCHDOG ModI had my Verizon FIOS service upgraded the other day and I was unable to shutdown all of my miners before the tech interrupted my internet. This made me scrutinize how the watchdog handles that situation (not very well, IMO) so I made the following modification to just wait on internet service to return rather than just looping, restarting mining, and restarting the host as usual.
if [ $COUNT -le 0 ]
then
# Begin Stubo Mod
# Wait for Internet
while ! nc -vzw1 google.com 443;
do
echo "Internet is down, checking again in 30 seconds..." | tee -a ${LOG_FILE} ${ALERT_LOG_FILE}
sleep 30
done
#
# INTERNET_IS_GO=0
#
# if nc -vzw1 google.com 443;
# #if nc -vzw1 $POOL 80;
# then
# INTERNET_IS_GO=1
# fi
echo ""
# if [[ $RESTART -gt 4 && $INTERNET_IS_GO == 1 ]]
if [ $RESTART -gt 4 ]
# End Stubo Mod
then
echo "$(date) - Utilization is too low: reviving did not work so restarting system in 10 seconds" | tee -a ${LOG_FILE} ${ALERT_LOG_FILE}
Let me know if you have any questions or see room for improvement in this modification.
I felt some thing is not right before when internet was down, but couldn't figure out why
So isnt this :
if [[ $RESTART -gt 4 && $INTERNET_IS_GO == 1 ]]
Should go to restart system only if both arguments are true ?
Restart greater than 4 and internet is go = 1 ?
Edit:
Think I found the problem,
It will wait for internet to comes up then restart system when restart is greater than 4, right?