From owner-freebsd-questions Mon Feb 5 9:50:29 2001 Delivered-To: freebsd-questions@freebsd.org Received: from smtp.smed.com (unknown [64.46.248.11]) by hub.freebsd.org (Postfix) with ESMTP id E1A0237B65D for ; Mon, 5 Feb 2001 09:50:08 -0800 (PST) Received: from smtpgate.shrmed.com (unknown [64.46.248.1]) by smtp.smed.com (Postfix) with ESMTP id 2776416178 for ; Mon, 5 Feb 2001 12:50:07 -0500 (EST) Received: from iesa14.shrmed.com (iesa14.shrmed.com [10.1.99.114]) by smtpgate.shrmed.com (8.9.3/8.9.3) with ESMTP id MAA15043 for ; Mon, 5 Feb 2001 12:49:27 -0500 From: Joe.Warner@smed.com Received: from Deimos.smed.com (unverified) by iesa14.shrmed.com (Content Technologies SMTPRS 2.0.15) with SMTP id ; Mon, 05 Feb 2001 12:49:03 -0500 Received: by Deimos.smed.com(Lotus SMTP MTA v4.6.5 (863.2 5-20-1999)) id 852569EA.0061982A ; Mon, 5 Feb 2001 12:45:59 -0500 X-Lotus-FromDomain: SMS To: Ken Bolingbroke Cc: freebsd-questions@freebsd.org Message-Id: <852569EA.00619636.00@Deimos.smed.com> Date: Mon, 5 Feb 2001 10:49:42 -0700 Subject: Re: Help me make FreeBSD shine MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Thanks! This may do what I need. Regardless of what port or script I use, I need to be able to send the output to a text or html file that I can put in my web directory, so that the information in the file can be viewed through a web browser from any node on our network. Thanks Joe MS4-WEBSD = The Power To Serve MS4! http://ms4-websd.ms4.shrmed.com |--------+------------------------> | | Ken | | | Bolingbroke | | | | | | | | | 02/05/01 10:32| | | AM | | | | |--------+------------------------> >---------------------------------------------------------| | | | To: Joe Warner/SMS@SMS | | cc: freebsd-questions@FreeBSD.ORG | | Subject: Re: Help me make FreeBSD shine | >---------------------------------------------------------| You may find 'fping' in the Ports collection at /usr/ports/net/fping useful, as you can ping multiple hosts, and grep the responses for any non-responsive host. Ken On Mon, 5 Feb 2001 Joe.Warner@smed.com wrote: > > > Hey thanks! > > Right now, I'm just starting with something simple. > > I created this script: > > #!/bin/sh > > grep -v "#" /etc/hosts | awk '{print $1}' | while read host > do > ping -c 1 $host > done > > > ...and it works, except I want the output to be dumped > into a text file. > > Do you know how I should change this script so I could > do that? > > If this script doesn't do what my manager wants, I'll > definitely try yours. > > Thanks > > Joe > > > > > > > > > |--------+-----------------------> > | | Lucas Bergman| > | | | | > | > | | | > | | 02/05/01 | > | | 09:50 AM | > | | Please | > | | respond to | > | | lucas | > | | | > |--------+-----------------------> > >---------------------------------------------------------| > | | > | To: Joe Warner/SMS@SMS | > | cc: freebsd-questions@freebsd.org | > | Subject: Re: Help me make FreeBSD shine | > >---------------------------------------------------------| > > > > > > > Is there a way that I could write up some simple shell script that > > would ping the IP addresses of these systems and then log the output > > into a file that I could make accessible through a web browser? If > > so, I could set it to run in the CRON scheduler every four hours at > > specific times/days. > > Look at > > http://www.slb.to/~lucas/hacks/iplist-1.0.tar.gz > > This contains two scripts, iplist.sh and iplist2html.sh. The first > pings all the IP addresses on an 8-bit IP network and logs when each > was last heard from (in Unix time format, seconds since midnight on > 19700101). The second script creates a web page that shows which IP > addresses are "free" (have not been heard from in greater than some > number of seconds, by default twenty days). This helps out my old > employer who refused to use DHCP but who wanted an easy way to assign > free IP addresses. > > The package also contains a trivial C program which prints the current > time in seconds since the Unix epoch. > > I have a cron job that runs `sh /path/to/iplist.sh' every few hours > and `sh /path/to/iplist2html.sh >/path/to/freeip.html' afterward. I > would advise *not* running these scripts as root. Also, ideally you > would run `sh iplist2html.sh >freeip.html.tmp && mv freeip.html.tmp > freeip.html' so that freeip.html isn't truncated if iplist2html.sh > bombs in the middle of a run. iplist.sh does not corrupt its data > file if it crashes. > > Hopefully, this is similar enough to what you want to do that it will > get you started. > > Lucas > > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message