πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #15465

Re: Programa para IPs libres

#15465
From: J.A. Gutierrez
Date: Thu, 29 Jun 2000 00:00
61 lines
2312 bytes
RaοΏ½l (Ridiculum) <Ridiculum@bionichat.com> wrote:

:     "ping" -c1 $ip_begin

	por que entre comillas?

	Aparte de eso, no puedes garantizar que ping devuelva
	un valor de exit o fail en cualquier unix; ademas, el
	timeout por defecto es demasiado elevado para redes locales.

	Para este tipo de cosas, lo mejor es usar 'fping'.

	Ejemplo (que hace otra cosa distinta)

---------------------------------------------------------------------------
#!/bin/sh

#
# uncomment if your fping is not installed setuid root
#

#if [ "`id -u`" != "0" ]
#then
#	echo Sorry, $0 requires root privs.
#	exit 1
#fi

TIME=0
TIMEOUT=100

set -- `getopt ht:T: $*`
for i in $*
do
	case $i in
	-t) TIME=$2; shift; shift;;
	-T) TIMEOUT=$2; shift; shift;;
	-h)
		/bin/echo "Use: `basename $0` [-htT] host"
		/bin/echo "-t: Time (default $TIME)"
		/bin/echo "-T: Timeout (default $TIMEOUT)"
		exit 0
		;;
	esac
done

shift

while :
do
	fping -q -t $TIMEOUT $* &&\
	sfplay /usr/local/files/sound/frog.aiff >/dev/null ||\
	echo no
	sleep $TIME
done
---------------------------------------------------------------------------

-- 
PGP and other useless info at      \                 Oh, show us the way
http://www.cps.unizar.es/~spd/      \             to the next whisky bar
finger://daphne.cps.unizar.es/spd    \                      Weill/Bretch
es doloroso ser sabio y descubrir la sopa de ajo                   (Pla)
Technical Details
Message-ID: <8jfhic$q54$1@news.unizar.es>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3951374E.5E2C5634@omgs.es> <39528D1E.4EF2E784@omgs.es> <slrn8li15l.540.Ridiculum@localname.localdomain> <slrn8lid5o.150.Ridiculum@localname.localdomain>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f86c8,d23863885ae5cfe3
X-Google-Attributes: gidf86c8,public
From: "J.A. Gutierrez" <spd@daphne.cps.unizar.es>
Subject: Re: Programa para IPs libres
Date: 2000/06/29
Message-ID: <8jfhic$q54$1@news.unizar.es>
X-Deja-AN: 640384654
Content-Transfer-Encoding: 8bit
References: <3951374E.5E2C5634@omgs.es> <39528D1E.4EF2E784@omgs.es> <slrn8li15l.540.Ridiculum@localname.localdomain> <slrn8lid5o.150.Ridiculum@localname.localdomain>
Content-Type: text/plain; charset=ISO-8859-1
X-Complaints-To: usenet@news.unizar.es
X-Trace: news.unizar.es 962283916 26788 155.210.152.20 (29 Jun 2000 13:05:16 GMT)
Organization: Rank
Mime-Version: 1.0
User-Agent: tin/1.4.1-19991201 ("Polish") (UNIX) (IRIX/6.2 (IP22))
NNTP-Posting-Date: 29 Jun 2000 13:05:16 GMT
Newsgroups: es.comp.os.linux.programacion