Complete.Org: Mailing Lists: Archives: discussion: November 1998:
Re: [aclug-L] shell script
Home

Re: [aclug-L] shell script

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: aclug-L@xxxxxxxxxxxx
Subject: Re: [aclug-L] shell script
From: Bob Deep <bobd@xxxxxxxxxxxx>
Date: Fri, 20 Nov 1998 08:54:20 -0600
Reply-to: aclug-L@xxxxxxxxxxxx

Jesse Kaufman wrote:
> 
> is there some sort of shell script that can do the following for me?
> 
> 1.) run ping <arbitrary webpage> (i usually just do yahoo)
> 2.) if it connects no problems, just exit, doing nothing...
> 3.) if it is down send an e-mail to a predefined list of people (my
> netadmins)
>     with the subject line "quadnet's down AGAIN..."
> 
> the LAN i am on is up and down all the time, and unfortunately all
> network administers for it are not accessing inet via this LAN, so they
> only know it's down when they manually check (this server is, of course,
> windoze).

I don't know much about send mail, but you can write a script that does
what you want very easily...

Set up a loop, that loops for ever in the scripting language of
choice...

Inside that loop you do the following...

sleep for some length of time (say, 2 min or so)

ping some host once "ping -c 1 "

Check the return code of the ping...
0=Success, your network is alive
else... Send your mail message

Start the loop over...

I can help you with bash, csh, ksh, perl or even C and C++ versions of
this script if you have trouble with how to get it working..

-= bob =-
---
This is the Air Capitol Linux Users Group discussion list.  If you
want to unsubscribe, send the word "unsubscribe" to
aclug-L-request@xxxxxxxxxxxx.  If you want to post to the list, send your
message to aclug-L@xxxxxxxxxxxx.



[Prev in Thread] Current Thread [Next in Thread]