Re: Server monitoring script
From: Jess (tojess2_at_btinternet.com)
Date: 04/08/04
- Next message: Charles Demas: "Re: joining two files with a common column"
- Previous message: Joe Philip: "joining two files with a common column"
- In reply to:(deleted message) Peter Boosten: "Re: Server monitoring script"
- Next in thread: Peter Boosten: "Re: Server monitoring script"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 8 Apr 2004 17:03:18 +0000 (UTC)
Cheers,
That works perfectly.
Jess
"Peter Boosten" <niemand@nergens.loc> wrote in message
news:slrnc779ph.v37.niemand@ramses.egypt.nl...
> on Wed, 07 Apr 2004 at 06:48 GMT, Jess wrote:
> > How can I use ping in a shell script to check if a server is responding
or
> > not?
> >
> > for example
> >
> > If get reply from ping -t 5 192.168.0.4 then
> >
> > do nothing
> >
> > else
> > send email to webmaster@xxx.com
> >
> > fi
> >
> > One of my servers keeps crashing, it is a slackware linux server
> >
> > I want to use one of thre uix servers to check every 20 mionutes if it
is up
> > and if not, notify by email
> >
> > Thanks
> > Jess
> >
> >
> #!/bin/sh
> #
> # $Id: conchk,v 1.5 2003/02/02 19:02:04 peter Exp $
> #
> # Connectivitycheck for multiple hosts
> #
> # Author: Peter Boosten
> #
>
> HOSTS="host1 host2"
>
> for host in ${HOSTS}; do
> status=`ping -c 2 ${host} > /dev/null && echo 1`
> if [ "${status}" = 1 ]; then
> if [ -f /tmp/${host}.not ]; then
> rm /tmp/${host}.not
> echo "${host} online again `date '+%H:%M %d-%m-%y'`" \
> | mail -s "connectivity update" peter
> fi
> else
> if [ -f /tmp/${host}.not ]; then
> echo "do nothing" > /dev/null
> else
> touch /tmp/${host}.not
> echo "${host} offline on `date '+%H:%M %d-%m-%y'`" \
> | mail -s "CONNECTIVITY ALERT" peter
> fi
> fi
> done
>
> Regards, Peter
> --
> Monday is an awful way to spend one seventh of your life.
>
> MSN/Mail: pboosten at hotmail dot com
- Next message: Charles Demas: "Re: joining two files with a common column"
- Previous message: Joe Philip: "joining two files with a common column"
- In reply to:(deleted message) Peter Boosten: "Re: Server monitoring script"
- Next in thread: Peter Boosten: "Re: Server monitoring script"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|