IP Ping script | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

IP Ping script

Shell Programming and Scripting


Tags
linux

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 10-11-2002
perleo perleo is offline
Registered User
 
Join Date: Aug 2002
Last Activity: 30 March 2011, 8:28 AM EDT
Location: Ireland
Posts: 143
Thanks: 0
Thanked 0 Times in 0 Posts
Java IP Ping script

i need a script that will go out onto the network and ping all 14 windows computers and report back.and do this every day at 12pm. The servers ip is 192.168.101 and works up to 192.168.125 to the machines

anyone please help.
Sponsored Links
    #2  
Old 10-11-2002
Kelam_Magnus's Avatar
Kelam_Magnus Kelam_Magnus is offline Forum Advisor  
Registered User
 
Join Date: Aug 2001
Last Activity: 18 April 2013, 3:03 PM EDT
Location: San Antonio, TX,
Posts: 1,070
Thanks: 0
Thanked 4 Times in 4 Posts
Just set up a script to ping each box by name. Possibly in a for loop. put your hosts in a file one per line with full DNS name or IP address.

for name in `cat hosts.file`
do
ping "some command here" >> file.report
done 2> error.log
done

This may be crude, but it should work. Set it up in cron to run everyday at 12.


Try searching this forum for PING or something similar to your topic.

Sponsored Links
    #3  
Old 10-11-2002
epdgesell epdgesell is offline
Registered User
 
Join Date: Jun 2002
Last Activity: 26 October 2002, 2:38 AM EDT
Location: NJ
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
#!/bin/ksh

let x=101
while [[ $x != 126 ]]
do
ping -c 1 192.168.101.$x || echo 192.168.101.$x >>/var/outputfilename
let "x = x + 1"
done

Run this in cron every day at 12
    #4  
Old 10-12-2002
perleo perleo is offline
Registered User
 
Join Date: Aug 2002
Last Activity: 30 March 2011, 8:28 AM EDT
Location: Ireland
Posts: 143
Thanks: 0
Thanked 0 Times in 0 Posts
thanks

thanks. i made the list of ips and saved it as iping

should the script look like this??


for name in `iping.pl`
do
ping "some command here" >> file.report
done 2> error.log
done



or what should i save the list as?
Sponsored Links
    #5  
Old 10-12-2002
perleo perleo is offline
Registered User
 
Join Date: Aug 2002
Last Activity: 30 March 2011, 8:28 AM EDT
Location: Ireland
Posts: 143
Thanks: 0
Thanked 0 Times in 0 Posts
i keep gettin a error
it says: Missing $ on loop variable at script line one


whats wrong >?
Sponsored Links
    #6  
Old 10-12-2002
saabir saabir is offline
Registered User
 
Join Date: Sep 2002
Last Activity: 5 July 2006, 10:23 AM EDT
Location: UK
Posts: 65
Thanks: 0
Thanked 1 Time in 1 Post
for name in `cat iping.pl`
do
ping $name >> file.report
done 2> error.log

For speed in completing the loop you may want to use the -c switch (linux) and limit the number of ICMP packets sent to each machine to 1.
Sponsored Links
    #7  
Old 10-12-2002
perleo perleo is offline
Registered User
 
Join Date: Aug 2002
Last Activity: 30 March 2011, 8:28 AM EDT
Location: Ireland
Posts: 143
Thanks: 0
Thanked 0 Times in 0 Posts
still getting that error on line 1


how do i make this for loop ?
anyone got like a template i can edit for it?
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Using ping in script mikez104 Shell Programming and Scripting 10 03-27-2012 07:22 PM
Animation Ping on Solaris Like Cisco Ping gokcell Shell Programming and Scripting 1 12-04-2011 04:12 AM
Help With Ping Script spmitchell Shell Programming and Scripting 1 12-05-2010 02:57 AM
Ping script sriram003 Shell Programming and Scripting 2 05-26-2008 11:47 PM
Ping Script mcrosby Shell Programming and Scripting 3 06-02-2006 11:11 AM



All times are GMT -4. The time now is 10:29 AM.