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

my nc command is not working inside the shell, if i copy the command from the output file in the command prompt then it works fine as expected.

code:

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//:/ }
                result=$"nc -z $hosts"	
                echo $result >testouput.txt
        fi
done

ouput:
nc -z boston02-vip.iris2.local 1521

please advice scrutinizer.
 

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
gkrellmd(1)							   User's Manual						       gkrellmd(1)

NAME
gkrellmd - The GNU Krell Monitors Server SYNOPSIS
gkrellmd [ --help ] [ --verbose ] [ -u | --update-hz N ] [ -m | --max-clients N ] [ -P | --port N ] [ -a | --allow-host hostname ] DESCRIPTION
gkrellmd Listens for connections from gkrellm clients. When a gkrellm client connects to a gkrellmd server all builtin monitors collect their data from the server. However, the gkrellm process is running on the local machine, so any enabled plugins will run in the local context (Flynn is an example exception to this since it derives its data from the builtin CPU monitor). Also, any command launching will run commands on the local machine. There is no support for file system mounting and local mailbox checking on the machine where the gkrellmd server is running. OPTIONS
-h --help Displays usage information and exits. -v --version Prints gkrellmd version and exits. -V --verbose Prints connection progress. -u, --update-hz f Sets the data update frequency in samples per second for the server. This is independent of and should be less than the gkrellm client update rate. The rate can be from 1 to 10 and should be lower to minimize network traffic. A value of not much more than 1/2 the client update rate is best where it is not important to minimize network traffic. -m, --max-clients N Sets the maximum number of simultaneous clients allowed to connect to the server. -P, --port server_port Use server_port for the network connection. -a, --allow-host hostname Specify hosts which are allowed to connect. Multiple allow-host arguments may be given. If no hosts are specified on the command line or in a gkrellmd.conf file, then all hosts are allowed to connect. Also, if hostname is the keyword ALL then all hosts are allowed. This option is additive and specified hosts will be added to the hostnames listed in gkrellmd.conf files unless the --clear-hosts option is given first. -c, --clear-hosts Clears the current list of allowed hosts. Use this before any --allow-host arguments if you want command line allowed hosts to override and not be additive to those specified in gkrellmd.conf files. FILES
/etc/gkrellmd.conf System server config which is read first. The config file may contain lines similar to the command line args. For example: allow-host localhost allow-host 127.0.0.1 port 19150 max-clients 2 update-hz 2 /usr/local/etc/gkrellmd.conf Local server config file which is read second. ~/.gkrellmd.conf User server config file which is read last. With the exception of --allow-hosts, command line args will override options in gkrellmd.conf files. AUTHOR
Bill Wilson <bill@gkrellm.net>. http://www.gkrellm.net/ GNU
/Linux July 24, 2002 gkrellmd(1)
All times are GMT -4. The time now is 01:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy