*BSD News Article 74000


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!nntp.coast.net!howland.reston.ans.net!vixen.cso.uiuc.edu!newsfeed.internetmci.com!ns1.iamerica.net!xavier.varmm.com!amusgrov
From: amusgrov@varmm.com (AJ Musgrove)
Newsgroups: comp.sys.sun.admin,alt.sys.sun,comp.unix.bsd.misc,comp.unix.programmer,comp.unix.bsd.bsdi.misc,comp.unix.admin
Subject: Re: ping script
Followup-To: comp.sys.sun.admin,alt.sys.sun,comp.unix.bsd.misc,comp.unix.programmer,comp.unix.bsd.bsdi.misc,comp.unix.admin
Date: 17 Jul 1996 13:50:18 GMT
Organization: LDS i-America
Lines: 32
Message-ID: <4sir2q$t5@ns1.iamerica.net>
References: <Pine.SOL.3.93.960702171209.4062B-100000@gold.acns.fsu.edu>
NNTP-Posting-Host: xavier.varmm.com
X-Newsreader: TIN [version 1.2 PL2]
Xref: euryale.cc.adfa.oz.au comp.sys.sun.admin:70678 alt.sys.sun:10416 comp.unix.bsd.misc:1253 comp.unix.programmer:39675 comp.unix.bsd.bsdi.misc:4325 comp.unix.admin:44991

Douglass E. Davis (davis@gold.acns.fsu.edu) wrote:

: I am trying to make a script that will ping a computer every few minutes
: and run a program if there is no answer.  

: I was thinking about making a C program to do the same thing. it would
: just do a :
: system("ping blazay > datafile ")
: then it would read datafile  to see if the ping worked.

: But if some one has a script or C program  that could do this I would
: appreciate the source, or if you could just tell me how to do it.

----------[]-----------------------
#!/bin/sh

ping blazay 2>&1 1> /dev/null
while [ $? -eq 0 ] ; do
   ping blazay 2>&1 1> /dev/null
   sleep 180 ; # three mintues
done
your_program_goes_here
-------------------[]---------------

--
AJ Musgrove

----------------------------------------------------------------
My opinions do not necessarily reflect those of MFS, or anyone
else for that matter. O-
----------------------------------------------------------------