Advertisement
Guest User

Untitled

a guest
Jan 19th, 2020
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1.  
  2. #!/bin/bash
  3.  
  4. TMP_FILE=/tmp/inet_up
  5.  
  6. # Edit this function if you want to do something besides reboot
  7.  
  8. yes_inet_action() {
  9. reboot
  10. }
  11.  
  12. no_inet_action() {
  13. if ping -c5 google.com; then
  14. echo 1 > $TMP_FILE
  15. [[ `cat $TMP_FILE` == 0 ]] && no_inet_action || echo 0 > $TMP_FILE
  16. else
  17. echo 1 > $TMP_FILE
  18. [[ `cat $TMP_FILE` == 0 ]] && yes_inet_action || echo 0 > $TMP_FILE
  19. fi
  20. }
  21.  
  22. if ping -c5 google.com; then
  23. echo 1 > $TMP_FILE
  24. [[ `cat $TMP_FILE` == 0 ]] && no_inet_action || echo 0 > $TMP_FILE
  25. else
  26. [[ `cat $TMP_FILE` == 0 ]] && yes_inet_action || echo 0 > $TMP_FILE
  27. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement