Skip to end of metadata
Go to start of metadata

The below bash script trigger rebooting server if Google DNS does not respond

#!/bin/bash
target="8.8.8.8"
count=$( ping -c 1 $target | grep icmp* | wc -l )
if [ $count -eq 0 ]
then
	date >> /home/user/pingfail.txt
	/sbin/shutdown -r now
else
	date >> /home/user/pingsuccess.txt
fi