Last active
October 30, 2020 12:57
-
-
Save e-minguez/42698c72e216af4f00c160d3ef0082c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
TIMES=4 | |
HOST=$(ip route show default | awk '/default/ {print $3}') | |
/bin/ping -c${TIMES} ${HOST} > /dev/null | |
if [ $? != 0 ] | |
then | |
/sbin/shutdown -r now "No connectivity to ${HOST}, rebooting..." | |
fi | |
# Then in crontab | |
#*/5 * * * * /root/pingordie.sh > /dev/null 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment