Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-29-2007, 01:11 PM   #1
LQ Newbie
Registered: May 2005
Location: Caribbean
Distribution: Red Hat Enterprise 3
Posts: 1

Rep: Reputation: 0
Basic ping script

I just started out with bash scripting and decided to write a simple ping program that pings my network and record the host ip address. The program works but since it ping every host once, it takes to much time. Is there another (simple) way that the program ping every host but faster?



for ((n=0 ; n < 255 ; n+=1))
	if ping -c 1 -w 1 $ip
        echo $host>>livehost
Old 01-29-2007, 01:38 PM   #2
Senior Member
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,393
Blog Entries: 1

Rep: Reputation: 64
It depends for what you are pinging an host.

There is the fping program. It could be used in your scripting not inside a loop, but specifying the range of ips to ping, in just one command.
There is the nmap program too, which is used as a network discovery tool. It can check if a host is up, not just sending ICMP packets but sending half-protocol and guessing the status without complete the protocol.
And there is the nice arpalert tool, which uses the ARP protocol to create a list of hosts in your site, and send alerts when a new host is plugged in your network.

I hope one of theses can satisfy your requirements.


ping, script

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with a basic script rsmccain Programming 5 07-03-2006 07:28 AM
Basic Shell Script Help Vasquez Linux - Newbie 3 02-28-2005 08:14 PM
Basic shell script, please help colly Linux - General 4 10-05-2004 12:24 PM
Basic networking IPTable Do I have to?? I canīt ping my machines jimdaworm Linux - Networking 18 11-30-2003 12:10 AM
Help with basic Administrator Script NightWolf_NZ Programming 1 09-11-2003 02:17 AM

All times are GMT -5. The time now is 11:58 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration