Bash Restart on Network Failure

[UPDATED INFORMATION]

Here’s a bash script I’m using on my server to restart the server in the event network goes down.  I set this up because, during a large file transfer through Samba, the server’s network stopped responding.  To be on the safe side, I’m doing a full restart.

The scripts attempt to ping HOST (192.168.1.1, my router), MAX_FAILURES (3) times.  After the 3rd failure, the server will restart.  If the network comes back before the restart, we’ll proceed as if nothing happened.  I’m waiting 5 minutes between each attempt.

I’m running this through an hourly cronjob.