waitnet.sh 698 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/sh
  2. PATH="/usr/sbin:/usr/bin:/sbin:/bin"
  3. count=0
  4. while :
  5. do
  6. ping -c 1 -W 1 -q www.baidu.com 1>/dev/null 2>&1
  7. if [ "$?" == "0" ]; then
  8. /etc/init.d/AdGuardHome force_reload
  9. break
  10. fi
  11. ping -c 1 -W 1 -q 202.108.22.5 1>/dev/null 2>&1
  12. if [ "$?" == "0" ]; then
  13. /etc/init.d/AdGuardHome force_reload
  14. break
  15. fi
  16. sleep 5
  17. ping -c 1 -W 1 -q www.google.com 1>/dev/null 2>&1
  18. if [ "$?" == "0" ]; then
  19. /etc/init.d/AdGuardHome force_reload
  20. break
  21. fi
  22. ping -c 1 -W 1 -q 8.8.8.8 1>/dev/null 2>&1
  23. if [ "$?" == "0" ]; then
  24. /etc/init.d/AdGuardHome force_reload
  25. break
  26. fi
  27. sleep 5
  28. count=$((count+1))
  29. if [ $count -gt 18 ]; then
  30. /etc/init.d/AdGuardHome force_reload
  31. break
  32. fi
  33. done
  34. return 0