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" <aclug-L@xxxxxxxxxxxx>
Subject: Re: [aclug-L] shell script
From: Jeff <schaller@xxxxxxxxxxx>
Date: Fri, 20 Nov 1998 08:20:51 -0600 (CST)
Reply-to: aclug-L@xxxxxxxxxxxx

On Fri, 20 Nov 1998, Cheez-Czar wrote:

> On Thu, 19 Nov 1998, 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..."

---------->8-------------

#!/bin/sh

# find out what ping option there is to not send packets
# continually, but rather to stop once its found out whether
# the host is reachable or not.
# THIS SCRIPT IS UNTESTED AND MAY OR MAY NOT WORK FOR WHAT YOU WANT

HOST=foo.bar.baz
PING_OPT=
RECIPS="one@four two@five three@six"

ping $PING_OPT $HOST > /dev/null

RESULT=$?

if [ $RESULT -eq 1 ]
then
  mailx -s"quadnet's down AGAIN..." $RECIPS < /dev/null
fi

----------8<-------------

You realize of course, that if your local lan is down, mail isn't
going to go very far :)

> > along with that question brings another question:  is there a way to
> > configure sendmail to not use <username>@<localhost name>, and instead
> > something like kaufmjes@xxxxxxxxxxxxxxx, or the like?

I've done something similar with my MUA -- pine -- by setting up a
customized identity (main: setup: config) on my linux box that I use
to dial up to southwind.

-jeff
-----
Jeff Schaller, UNIX System Administrator, Learjet Inc.
Phone: 316 946-7255, Fax: 316 946-2809
The above thoughts are mine and are not representative of Learjet.
 8:19am up 7 days, 21:19, 7 users, load average: 0.13, 0.23, 0.20



---
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]