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
ADSL-CONNECT(8) 					      System Manager's Manual						   ADSL-CONNECT(8)

NAME
adsl-connect - Shell script to manage a PPPoE link SYNOPSIS
adsl-connect [config_file] adsl-connect interface user [config_file] DESCRIPTION
adsl-connect is a shell script which manages an ADSL connection using the Roaring Penguin user-space PPPoE client. If you omit con- fig_file, the default file /etc/sysconfig/network-scripts/ifcfg-ppp0 is used. If you supply interface and user, then they override the Ethernet interface and user-name settings in the configuration file. Note that normally, you should not invoke adsl-connect directly. Instead, use adsl-start to bring up the ADSL connection. adsl-connect first reads a configuration file. It then brings up a PPPoE connection. If the connection ever drops, a message is logged to syslog, and adsl-connect re-establishes the connection. In addition, each time the connection is dropped or cannot be established, adsl- connect executes the script /etc/ppp/adsl-lost if it exists and is executable. The shell script adsl-stop causes adsl-connect to break out of its loop, bring the connection down, and exit. TECHNICAL DETAILS
adsl-connect uses the following shell variables from the configuration file: ETH The Ethernet interface connected to the ADSL modem (for example, eth0). USER The ADSL user-id (for example, b1xxnxnx@sympatico.ca). PIDFILE A file in which to write the process-ID of the adsl-connect process (for example, /var/run/pppoe.pid). Two additional files ($PID- FILE.pppd and $PIDFILE.pppoe) hold the process-ID's of the pppd and pppoe processes, respectively. By using different configuration files with different PIDFILE settings, you can manage multiple PPPoE connections. Just specify the con- figuration file as an argument to adsl-start and adsl-stop. AUTHOR
adsl-connect was written by David F. Skoll <dfs@roaringpenguin.com>. The pppoe home page is http://www.roaringpenguin.com/pppoe/. SEE ALSO
pppoe(8), adsl-start(8), adsl-stop(8), pppd(8), pppoe.conf(5), adsl-setup(8), adsl-status(8), pppoe-sniff(8), pppoe-server(8), pppoe- relay(8) 4th Berkeley Distribution 21 February 2000 ADSL-CONNECT(8)
All times are GMT -4. The time now is 08:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy