Created
November 12, 2012 20:26
-
-
Save mybuddymichael/4061665 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 | |
ip_address="$1" | |
ping -c 1 "$ip_address" > /dev/null | |
if [ $? -gt 0 ]; then | |
log_line="`date` : Ping to $ip_address unsuccessful, REBOOTING." | |
echo "$log_line" >> /var/log/ping-or-reboot | |
/sbin/reboot | |
else | |
log_line="`date` : Ping to $ip_address successful, not rebooting." | |
echo "$log_line" >> /var/log/ping-or-reboot | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment