Re: [aclug-L] shell script
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Bob Deep wrote:
> 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..
oh, and i just want a script that i manually run... i don't really care
about having some process running in the background checking all the time...
sometimes, it goes down for 2 secs, but is back up, and i don't want it to
send an e-mail then (although i should, so they get this LAN working
right!)... just a manually run script would be fine with me... tho', what
do you think would be better?
--
+============================+============================+
! Tabor College ! ICQ UIN1: 4022791 !
! 400 S. Jefferson ! ICQ UIN2: 13115282 !
! Hillsboro, KS 67063 ! kaufmjes@xxxxxxxxxxxxxxxxx !
+============================+============================+
---
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.
|
|