Guest User

Untitled

a guest
Feb 17th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #!/usr/bin/bash
  2.  
  3. /usr/bin/date > /root/booting.log
  4.  
  5. # Wait for internt online
  6. ((count = 600)) # Maximum number to try.
  7. while [[ $count -ne 0 ]] ; do
  8.  
  9. ping -c 1 8.8.8.8 > /dev/null 2>&1 # Try once.
  10. rc=$?
  11. if [[ $rc -eq 0 ]] ; then
  12.  
  13. ((count = 1)) # If okay, flag to exit loop.
  14.  
  15. else
  16.  
  17. sleep 1
  18. echo "Wait count : $count"
  19.  
  20. fi
  21.  
  22. ((count = count - 1)) # So we don't go forever.
  23.  
  24. done
  25.  
  26.  
  27.  
  28. if [[ $rc -eq 0 ]] ; then # Make final determination.
  29.  
  30. #DO SOMETIING
  31.  
  32. else
  33.  
  34. echo "Timeout for internet online wait" >> /root/booting.log
  35.  
  36. fi
Add Comment
Please, Sign In to add comment