Sponsored Content
Top Forums Shell Programming and Scripting Network script for ping status Post 302915786 by jaysunn on Thursday 4th of September 2014 04:14:43 PM
Old 09-04-2014
Perhaps something like this, it's not interactive, however it achieves what you want with test FQDN's that you can change to your IP's.


Code:
jaysunn-> cat ping_test.sh 
#!/bin/bash

ServerList='www.google.com www.bing.com www.yahoo.com www.fakesite1111.com'

for i in ${ServerList} ; do



    echo "-------------------------------------------------------------"
    echo ${i}
    echo "-------------------------------------------------------------"
    ping -c 1 ${i} |grep '1 packets transmitted'
    if [ $? == 0 ]
        then
            echo "Ping is ok"
        else
            echo "!!ping Bad!!"
    echo "-------------------------------------------------------------"
            exit 1
    fi
done

OUTPUT:
Code:
jaysunn-> bash ping_test.sh 
-------------------------------------------------------------
www.google.com
-------------------------------------------------------------
1 packets transmitted, 1 packets received, 0.0% packet loss
Ping is ok
-------------------------------------------------------------
www.bing.com
-------------------------------------------------------------
1 packets transmitted, 1 packets received, 0.0% packet loss
Ping is ok
-------------------------------------------------------------
www.yahoo.com
-------------------------------------------------------------
1 packets transmitted, 1 packets received, 0.0% packet loss
Ping is ok
-------------------------------------------------------------
www.fakesite1111.com
-------------------------------------------------------------
ping: cannot resolve www.fakesite1111.com: Unknown host
!!ping Bad!!
-------------------------------------------------------------
[~]

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Network Status

Hi, My system ( Solaris 2.6, Entrerprise 250 ) shows lot of connections in TIME_WAIT status against service localhost.8007 and localhost.45221 What are these services and where can I get the cross references. I have checked up in /etc/services and there is no such entry. Infact... (5 Replies)
Discussion started by: shibz
5 Replies

2. Shell Programming and Scripting

Multiple Network Card Status Script

I have multiple Sun Solaris 8 systems running multiple network cards. (Mix of quad and gig cards.) What I would like to do is create a monitor script to ensure high availability of these cards. Has anyone ever had a situation like this? I was thinking of using the ping command, but am... (1 Reply)
Discussion started by: Krusty
1 Replies

3. UNIX for Dummies Questions & Answers

NIC The Status Down but I can ping the localhost??!!

Hello, hi guys I don't know what is the problem with my NIC I can ping the Localhost (LOOPBACK) but when I run a scripts to check the NIC statuse it's shown the NIC DOWN sooo what could be the problem and what is the best way to start trouplshooting the NIC in SUN-SOLARIS. Regards, Karim ... (3 Replies)
Discussion started by: geoquest
3 Replies

4. UNIX for Advanced & Expert Users

ping all the machines in the network

Is there any option for the utility "ping" , which can ping all the machines in the network? (5 Replies)
Discussion started by: praveen_b744
5 Replies

5. IP Networking

Able to ping server's private network

Hi guys, I'm in the progress of setting up a private network in our Sun solaris platform. Existing ip: 172.16.102.101 New private ip: 192.168.2.3 Netmask is the same for both private & public 255.255.255.0 After setting up the ip, I'm able to ping this private ip address from our... (3 Replies)
Discussion started by: *Jess*
3 Replies

6. IP Networking

ping to different network in linux

Hi all, please help solving my small issue below is the configuration I have 3 systems sytem1 -------- system 2 ----------system 3 system 1 : 10.255.1.4 & default gw 10.255.1.55 system2 : ip 1 : 10.255.1.55 , ip 2: 10.255.2.1 system 3 : ip : 10.255.2.3 on system 2 : ... (4 Replies)
Discussion started by: Gopi Krishna P
4 Replies

7. Solaris

Solaris 10 - ping network issue

Hi, I'am begineer in this OS. I've installed it few days ago only to perform project "Managing users in Solaris". I have to create two virtual systems in eg. vmware , connect them and eg. rlogin from user1/machine1 to user2/machine2, give them some permissions to write read etc (this is... (1 Reply)
Discussion started by: michael.pelc
1 Replies

8. Red Hat

RHEL4 on VM cannot get status network link down

Hi All, RHEL4 on VM cannot get status network link down. when I unplug network cable. - ESX found interface down - but VM RHEL4 not detect that !, It show still up (mii-tool) Please help share you idea for my case. ESXi 5.1.0, RHEL4 Thank you, (3 Replies)
Discussion started by: arm_naja
3 Replies

9. AIX

Able to ping the server but not able to login through putty it says network timeout

Able to ping the server but not able to login through putty it says network timeout Please assist (3 Replies)
Discussion started by: Vishal_dba
3 Replies

10. Shell Programming and Scripting

Ping the service with out port number on remote network

I got the service status through nc on remote network but 2 services doesn't have port number.how to get the other 2 services status with out port number .pls provide the solution to me. I need to develop with is in a script (2 Replies)
Discussion started by: kannansoft1985
2 Replies
pppstats(8)						      System Manager's Manual						       pppstats(8)

NAME
pppstats - Print Point-to-Point Protocol (PPP) statistics SYNOPSIS
/usr/sbin/pppstats [-a] [-v] [-r] [-c count] [-w secs] [interface] [-z] OPTIONS
Displays absolute values rather than deltas. With this option, all reports show statistics for the time since the link was initiated. Without this option, the second and subsequent reports show statistics for the time since the last report. Repeats the display count times. The default repeat count is 1 if the -w option is not specified, otherwise infinity. Displays the overall packet compression rate. The rate value is between 0 and 1, with 0 meaning that the data is incompressible. Displays additional statistics, such as the number of packets ignored (rejected by the VJ TCP header decompression code). Pauses wait seconds between each display. If this option is not spec- ified, the default interval is 5 seconds. Instead of the standard display, show statistics indicating the performance of the packet com- pression algorithm in use. See the STATISTICS section for further information on this option. DESCRIPTION
The pppstats utility reports PPP-related statistics at regular intervals for the specified PPP interface. If interface is unspecified, it will default to ppp0. The display is split horizontally into input and output sections containing columns of statistics describing the properties and volume of packets received and transmitted by the interface. STATISTICS The following fields are printed on the input side when the -z option is not used: The total number of bytes received by this interface. The total number of packets received by this interface. The number of header-compressed TCP packets received by this interface. The num- ber of header-uncompressed TCP packets received by this interface. Not reported when the -r option is specified. The number of corrupted or bogus header-compressed TCP packets received by this interface. Not reported when the -r option is specified. The number of VJ header- compressed TCP packets dropped on reception by this interface because of preceding errors. Only reported when the -v option is specified. The total number of non-TCP packets received by this interface. Only reported when the -v option is specified. The compression ratio achieved for received packets by the packet compression scheme in use, defined as the uncompressed size divided by the compressed size. Only reported when the -r option is specified. The total number of bytes received, after decompression of compressed packets. Only reported when the -r option is specified. The following fields are printed on the output side: The total number of bytes transmitted from this interface. The total number of pack- ets transmitted from this interface. The number of TCP packets transmitted from this interface with VJ-compressed TCP headers. The number of TCP packets transmitted from this interface with VJ-uncompressed TCP headers. Not reported when the -r option is specified. The total number of non-TCP packets transmitted from this interface. Not reported when the -r option is specified. The number of searches for the cached header entry for a VJ header compressed TCP packet. Only reported when the -v option is specified. The number of failed searches for the cached header entry for a VJ header compressed TCP packet. Only reported when the -v option is specified. The compression ratio achieved for transmitted packets by the packet compression scheme in use, defined as the size before compression divided by the compressed size. Only reported when the -r option is specified. The total number of bytes to be transmitted, before packet compression is applied. Only reported when the -r option is specified. When the -z option is specified, pppstats displays the following fields, relating to the packet compression algorithm currently in use. If packet compression is not in use, these fields all display zeroes. The fields displayed on the input side are: The number of bytes of com- pressed packets received. The number of compressed packets received. The number of bytes of incompressible packets (that is, those which were transmitted in uncompressed form) received. The number of incompressible packets received. The recent compression ratio for incoming packets, defined as the uncompressed size divided by the compressed size (including both compressible and incompressible packets). The fields displayed on the output side are: The number of bytes of compressed packets transmitted. The number of compressed packets transmitted. The number of bytes of incompressible packets transmitted (that is, those which were transmitted in uncompressed form). The number of incompressible packets transmitted. The recent compression ratio for outgoing packets. SEE ALSO
Daemons: pppd(8) pppstats(8)
All times are GMT -4. The time now is 07:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy