Sponsored Content
Top Forums Shell Programming and Scripting Help with shell script to check the tcp network connectivity between server Post 302904025 by sknovice on Sunday 1st of June 2014 08:31:37 AM
Old 06-01-2014
Help with shell script to check the tcp network connectivity between server

Hello,

I have a requirement to check the tcp network connectivity between server it's running on and the list of host's and ports combination.

i have written the below code but it doesn't work, but when i execute the nc command outside the script it works fine.

please help me where i am going wrong.

Code:
#!/bin/bash
#read the file line by line

cd "$1"
cat testping.txt | while read line
do
        # check if there are no blank lines
        if [ ! -z $line ]; then
                hosts=$line|sed 's/:/ /g'
                result=$"nc -z $hosts"
                echo $result >testouput.txt
        fi
done

testping.txt file contains

Code:
seattle01.iris2.local:1522
boston01-vip.iris2.local:1521
boston02-vip.iris2.local:1521


Last edited by Scrutinizer; 06-01-2014 at 09:33 AM.. Reason: Formatting, code tags
 

10 More Discussions You Might Find Interesting

1. Programming

How to check TCP server status

Please tell me according to C/C++ socket programming; how client can check whether server is running or not during TCP communication. (1 Reply)
Discussion started by: mansoorulhaq
1 Replies

2. UNIX for Advanced & Expert Users

how to check if a process is running in a server from shell script.

I want to write a unix shell script that will check if a process (say debu) is running in the server or not. If no , then send a mail to the corresponding person to start the process??? (2 Replies)
Discussion started by: debu
2 Replies

3. Shell Programming and Scripting

Script to check connectivity

I want to write a script to check if a unix box say abc.tdc.cin.net can be connected or not on certain port say 22. right know i have to telnet them manually from DOS prompt and if it is successful then isay it is connected. Also to check Database connectivity I am using tnsping From DOS prompt.... (3 Replies)
Discussion started by: kukretiabhi13
3 Replies

4. Shell Programming and Scripting

Linux: Writing a tricky script to check connectivity

So, first and foremost, I'm having issues with my internet connection. Periodically, the connection drops across the network. The fix is simple enough: restart the modem. However, this gets old when the connection dies out every hour. I can hit my surfboard on 192.168.100.1, and navigate to a... (5 Replies)
Discussion started by: kungfujoe
5 Replies

5. Shell Programming and Scripting

Check connectivity script

This past weekend I had some issues with my ISP. So for future purpose I'm going to have some logging on my internet so I'm able to attach log files to my complaint email if this issue reoccurs. Decided to do a simple ping script that runs every 5 or 10 min with crontab if ping fail write date... (5 Replies)
Discussion started by: chipmunken
5 Replies

6. Solaris

Sybase Connectivity Check through Shell Script

Hi, I need to check the sysbase database connectivity through the Unix Shell Script. Can you help me on the how to write the script to test the sysbase database connection. Thanks in Advance Nandha (0 Replies)
Discussion started by: nandha2387
0 Replies

7. Shell Programming and Scripting

Check the connectivity of the DB through script, exit if no connection

check the connectivity of the DBs through script, script should exit if no connection and display the output as below. connectivity for DB1 is OK connectivity for DB2 is OK connectivity for DB3 is FAILED for DB in 1 2 3 do (sqlplus -s... (5 Replies)
Discussion started by: only4satish
5 Replies

8. IP Networking

Help with to check the tcp network connectivity between servers and hosts

ello, i am new to the networking side. I have a requirement to check the tcp network connectivity between server it's running on and the list of host's and ports combination. please help me where i am going wrong. my code: #!/bin/bash #read the file line by line cd "$1" cat... (17 Replies)
Discussion started by: sknovice
17 Replies

9. Solaris

External Network Connectivity w/Oracle VM Server for SPARC & Solaris 11

Hello all, thanks for reading my question: So I've been a Unix/Linux SysAdmin for a couple years, and I'm a bit over my head running solo, trying to set up LDoms using Oracle VM Server 3.1 for SPARC. I've been very careful, and things have gone well up until the point I try to access the new... (9 Replies)
Discussion started by: Lyxix
9 Replies

10. Shell Programming and Scripting

Check connectivity with multiple hosts - BASH script available here

Hi everyone! Some time ago, I had to check connectivity with a big list of hosts, using different formats (protocol://server:port/path/, server:port, ....). I developed a script that checks the connectivity using different commands (ping, telnet, nc, curl). It worked for me so I'm sharing it... (9 Replies)
Discussion started by: Fr3dY
9 Replies
dbeacon(1)						      General Commands Manual							dbeacon(1)

NAME
dbeacon - Distributed IPv4/IPv6 multicast beacon SYNOPSYS
dbeacon -a MAIL -b BEACON_ADDR[/PORT] [-i INTFNAME] [-n NAME] [-S [GROUP_ADDR[/PORT]] [-s ADDR] [-d [FILE]] [-I NUMBER] [-W type$url] [-L program] [-C CC] [-4] [-6] [-v] [-P] [-U] [-V] [-F flag] [-O] [-B ADDR] DESCRIPTION
dbeacon is a network level management tool aiming at getting various statistics about multicast connectivity. Its first usage is to check out if you can send/receive toward/from an IPv4/IPv6 multicast network. Its second usage is to gather various statistics by using a known multicast ASM group, for example TTL between each multicast peers, loss or jitter figures. Theses statistics are kept internally but can be dumped periodically in a file in xml format for latter processing. Statistics gathering is completetly distributed and rely on the powerful nature of ASM. No server is required, but maybe a http server for accessing the statistics and build an adjacency matrix of the peers. OPTIONS
-n NAME, -name NAME The name identifying you on the dbeacon session. If not specified, dbeacon will use the hostname of the running machine. -a MAIL Administrative contact. This is an e-mail used for join you, for example to notify you that something is wrong is your multicast connectivity -i IN, -interface IN Use IN instead of the default interface for multicast. -b BEACON_ADDR/PORT This is the IPv4/IPv6 address of the ASM group used by dbeacon to gather statistics. It can be specified as a DNS name too. -S GROUP_ADDR/PORT Enables SSM reception/sending on optional GROUP_ADDR/PORT -O This option enable SSM data sending in addition to ASM data. It can be used to check if people can reach you via SSM. -B ADDR This allows you to bootstrap from an ADDR that is already in the matrix. This option is useful when you ASM connectivity is broken but SSM connectivity works. -P, -ssmping Enable SSM Ping server capability. -s ADDR Bind to local address. This allow you to specify the multicast source of the packets sent by your beacon. -d FILE Dump periodic reports to dump.xml or specified file. This file may be latter processed by any XML compliant script. On a http server, you can process the dump to create a nice adjacency matrix. -I NUMBER, -interval NUMBER Interval between refresh of the dump file. Defaults to 5 secs if not specified -W URL, -website URL Specify a website to announce. -Wm URL, -matrix URL Specify your matrix URL. -Wl URL, -lg URL Specify your looking glass URL. -C CC Specify your two letter Country Code. -L program Launch program after each dump. The first argument will be the dump filename. -F flag Specify a flag to announce. For example to announce that your host is running a ssmpingd daemon, use `ssmping' as a flag. -4, -ipv4 Force IPv4 usage (Default is IPv6). -6, -ipv6 Force IPv6 usage -v verbose mode (use several for more verbosity) -U Dump periodic bandwidth usage reports to stdout -D, -daemon fork to the background (daemonize) -pidfile FILE Path to the PID file to write to. -syslog Outputs using syslog facility. -c FILE Specifies the configuration file to use. Each of the above command-line parameters can be defined there. -V, -version Outputs version information and leaves BUGS
Should be reported to the core developer Hugo Santos <hugo@fivebits.net>. HISTORY
dbeacon is a joint work of Hugo Santos, Sebastien Chaumontet and Mickael Hoerdt. It has been done in the early days of the m6bone, when nobody knew if the SPTs or RPTs were being used between hosts and also to evaluate the performance and deployment of SSM. User Manuals dbeacon(1)
All times are GMT -4. The time now is 05:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy