1.

Solve : Need a ping script?

Answer»

I need to write (or acquire) a script that continuously pings a site (google will do), and then execute a sound file if my internet CONNECTION drops out. The reason for this is that I have an application that needs to be constantly connected to the internet and if that connection drops out, which it does, I need to know immediately so that I can reset the connection. Is such a script difficult to write? Any insight would be greatly appreciated. Thanks in advance.I had a similar problem with the le DRIVER on Solaris 7 on my old SPARCstation-1

I WROTE a really simple cron job like this

Code: [Select]#!/bin/bash

ping -c 2 router || ping -c 2 laptop || reboot
which I called le-failed-reboot, and then ran every minute by sticking in crontab as
Code: [Select]* * * * * /root/le-failed-reboot 2>&1 1>/dev/null
To make a sound, you'd need to do something like
Code: [Select]cat file.mp3 > /dev/audioThank you, I'll try that.Yea writting a cron is the way to go.



Discussion

No Comment Found