Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- TMP_FILE=/tmp/inet_up
- # Edit this function if you want to do something besides reboot
- yes_inet_action() {
- reboot
- }
- no_inet_action() {
- if ping -c5 google.com; then
- echo 1 > $TMP_FILE
- [[ `cat $TMP_FILE` == 0 ]] && no_inet_action || echo 0 > $TMP_FILE
- else
- echo 1 > $TMP_FILE
- [[ `cat $TMP_FILE` == 0 ]] && yes_inet_action || echo 0 > $TMP_FILE
- fi
- }
- if ping -c5 google.com; then
- echo 1 > $TMP_FILE
- [[ `cat $TMP_FILE` == 0 ]] && no_inet_action || echo 0 > $TMP_FILE
- else
- [[ `cat $TMP_FILE` == 0 ]] && yes_inet_action || echo 0 > $TMP_FILE
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement