Sponsored Content
Full Discussion: shell script for ping
Top Forums Shell Programming and Scripting shell script for ping Post 302419987 by malcomex999 on Monday 10th of May 2010 09:07:14 AM
Old 05-10-2010
This is what i got for you in my archive which i used it in AIX quite long time ago, i hope it helps you...

Code:
# cat host
150.150.102.10
150.150.105.10
150.150.106.10
150.150.150.150
# cat pn
while read hostname
do
PL=$(ping -c 10 $hostname | grep "% packet" | awk '{gsub("%","",$0);print $7}')
 if [[ $PL -gt 50 ]]
  then
  echo "$hostname is not pinging" >> status
  else
   echo "$hostname is pinging" >> status
  fi
done < host
# cat status
150.150.102.10 is pinging
150.150.105.10 is not pinging
150.150.106.10 is pinging
150.150.150.150 is not pinging
#

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shell script queries: $home; broadcast ping

Dear all, This is the Bionic Fysh again. I have two quick questions: 1- when writing shell scripts, how does one allow the tilda ~ into the script ? e.g ls ~; ls ~me; user=you; ls ~$user (N.B I think that for this one you need: ls `~$user`) 2- In FreeBSD 4.0, I would like for a... (6 Replies)
Discussion started by: bionicfysh
6 Replies

2. Shell Programming and Scripting

Shell script to ping a range of IPs

Hi Can someone give me a shell script that can ping a range of IPs and return IPs which are not pingable. Range for example say 192.168.0.1 to 192.168.0.50 and whichever are not pingable then return the IP. Thanks for your help (3 Replies)
Discussion started by: tannu
3 Replies

3. Shell Programming and Scripting

Shell Script for ping, Linux

I woul like to create a script in order to make a ping to a server and save in a variable a 1 if respond or a 0 if it doesnt. Then with that I could make a graffic of the server, for how long it is up.:b: So far I have this: if ; then #if the ip respond the ping shows online echo... (3 Replies)
Discussion started by: jsebastiang0
3 Replies

4. Shell Programming and Scripting

Unix Shell Script to ping systems & make a log

Hi, I need to ping all the systems in my network and then create a log for the ones, from where I successfully get the ping-response (ICMP packet). Now, I've used the ping command successfully, but am unable to use 'grep' command to locate the IPs for which the ping was successful (so that I... (5 Replies)
Discussion started by: psychoTHEIST
5 Replies

5. Shell Programming and Scripting

Animation Ping on Solaris Like Cisco Ping

Hi, I develop simple animation ping script on Solaris Platform. It is like Cisco ping. Examples and source code are below. bash-3.00$ gokcell 152.155.180.8 30 Sending 30 Ping Packets to 152.155.180.8 !!!!!!!!!!!!!.!!!!!!!!!!!!!!!. % 93.33 success... % 6.66 packet loss...... (1 Reply)
Discussion started by: gokcell
1 Replies

6. Shell Programming and Scripting

Need bash script to ping the servers and rename the output file each time the script is ran

HI, I have a file serverlist in that all host names are placed. i have written a small script #./testping #! /bin/bash for i in `cat serverlist` do ping $i >> output.txt done so now it creates a file output.txt till here fine.. now each time i run this script the output file... (4 Replies)
Discussion started by: madhudeva
4 Replies

7. Shell Programming and Scripting

Ping shell script - need urgent help

Hi friends, i have a file contains IP address like below cat file.txt 10.223.20.1 10.223.20.2 10.223.20.3 10.223.20.4 10.223.10.5 . . . like this Now i want to make a script which gives output whether each ip is pinging or not... the result will be like this 10.223.20.1 up... (9 Replies)
Discussion started by: siva kumar
9 Replies

8. Shell Programming and Scripting

Need shell script to Telnet multiple node , Ping some IP and print output

Hi Team, Need shell script to Telnet multiple node , Ping some IP and print output like pass or fail. Need this script to check reachability of multiple nodes at same time. Help me. I use this but not working... Eg. in this script i need to telnet... (4 Replies)
Discussion started by: Ganesh Mankar
4 Replies

9. Programming

Ping test sends mail when ping fails

help with bash script! im am working on this script to make sure my server will stay online, so i made this script.. HOSTS="192.168.138.155" COUNT=4 pingtest(){ for myhost in "$@" do ping -c "$COUNT" "$myhost" &&return 1 done return 0 } if pingtest $HOSTS #100% failed... (4 Replies)
Discussion started by: mort3924
4 Replies

10. Shell Programming and Scripting

Shell script to ping multiple servers

Hi I did the following script to ping multiple servers, but I keep on receiveing duplicate emails for one server that is down: #!/bin/bash date cat /var/tmp/servers.list | while read output do ping -c 1 "$output" > /dev/null if ; then echo "node $output is up" else ... (10 Replies)
Discussion started by: fretagi
10 Replies
IMAGERECTANGLE(3)							 1							 IMAGERECTANGLE(3)

imagerectangle - Draw a rectangle

SYNOPSIS
bool imagerectangle (resource $image, int $x1, int $y1, int $x2, int $y2, int $color) DESCRIPTION
imagerectangle(3) creates a rectangle starting at the specified coordinates. PARAMETERS
o $ image -An image resource, returned by one of the image creation functions, such as imagecreatetruecolor(3). o $x1 - Upper left x coordinate. o $y1 - Upper left y coordinate 0, 0 is the top left corner of the image. o $x2 - Bottom right x coordinate. o $y2 - Bottom right y coordinate. o $color - A color identifier created with imagecolorallocate(3). RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 Simple imagerectangle(3) example <?php // Create a 200 x 200 image $canvas = imagecreatetruecolor(200, 200); // Allocate colors $pink = imagecolorallocate($canvas, 255, 105, 180); $white = imagecolorallocate($canvas, 255, 255, 255); $green = imagecolorallocate($canvas, 132, 135, 28); // Draw three rectangles each with its own color imagerectangle($canvas, 50, 50, 150, 150, $pink); imagerectangle($canvas, 45, 60, 120, 100, $white); imagerectangle($canvas, 100, 120, 75, 160, $green); // Output and free from memory header('Content-Type: image/jpeg'); imagejpeg($canvas); imagedestroy($canvas); ?> The above example will output something similar to:[NOT DISPLAYABLE MEDIA]Output of example : Simple imagerectangle() example PHP Documentation Group IMAGERECTANGLE(3)
All times are GMT -4. The time now is 12:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy