Testing telnet connections in a script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Testing telnet connections in a script
# 1  
Old 01-12-2007
Testing telnet connections in a script

Hi,

I am trying to figure out how to test to see if a server is accepting telnet connections via a script.

I have several remote MPE servers that are set in single user mode (and hence not accepting telnet connections), for their backups, I want to try and automate a test (from a unix server), to see if telnet connections are available and hence if the servers are still in single user mode.

Hmm ... not sure how clear that was ... I basically want to do something like this:

while true
do
telnet <server_name> > richtmp &
echo $! > richtmp.PID
***some kind of grep thing on 'richtmp' to see if the connection worked***
kill `cat richtmp.PID`
sleep 60
done


.... but more elegantly. Is there an option to the telnet command that will do this?

many thanks,

Richard
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Assistance with testing ssh connections and what the return codes mean

Hello Forum, I'm using a bit of code from a script I found that allows me to capture the status code of connecting via SSH to remote servers: ssh -qno StrictHostKeyChecking=no -o ConnectTimeout=1 user@$InputIP 'ls -l /home/user >/dev/null 2>&1' > /dev/null 2>&1 status="$(echo $?)" echo... (4 Replies)
Discussion started by: greavette
4 Replies

2. Shell Programming and Scripting

Could you help me writing a script showing which network connections are currently active?

Could you help me writing a script showing which network connections are currently active? Means output should be something like: "eth0, wlan1, wlan3" Problem: The output is supposed to happen on a 16x2 LCD Display. Currently I am doing a "Ifconfig" as output, but its too fast for the... (2 Replies)
Discussion started by: lordofazeroth
2 Replies

3. Shell Programming and Scripting

Using shell script to compare files and retrieve connections

Hello, I want to use shell script to generate network files (I tried with python but its taking too long). I have a list of nodes: node.txt LOC_Os11g37970 LOC_Os01g07760 LOC_Os03g19480 LOC_Os11g45740 LOC_Os06g08290 LOC_Os07g02800 I have an edge-list as well: edge.txt Source_node ... (2 Replies)
Discussion started by: Sanchari
2 Replies

4. Shell Programming and Scripting

ksh script to test max number of parallel ssh connections

hello , I need to check how many parallel ssh connections my server can take the load of. I need to login to different host which i am planning to read from a file and then a write a loop which will do parallel ssh. Please provide suggestion on how i can write script for the same.\ Thank... (1 Reply)
Discussion started by: ABHIKORIA
1 Replies

5. UNIX for Dummies Questions & Answers

Shell script to collect inbound connections

Hi Kindly provide me shell script on server to collect inbound connections, using port number on Linux. (4 Replies)
Discussion started by: adminhelp
4 Replies

6. Shell Programming and Scripting

How to create DB2 Connections in While loop using shell script

Hi , I have to create a db2 connection for the while loop in shell scripting. Below is the connection for DB2 I have to establish connect to TABLESCHENMA user $USERID using $PASSWORD Below is the while loop. while read TABLE; do db2 LOAD CLIENT FROM $DIRECTORY/$TABLE.ixf OF ixf INSERT... (1 Reply)
Discussion started by: vikyalex4
1 Replies

7. Shell Programming and Scripting

Expect/telnet/testing tacacs on a cisco

At times I find the need to test that the tacacs port 49 is open. The code below works but is painfully slow because I have to wait on the timeouts. Examples of possible responds router1#telnet 10.11.20.14 49 Trying 206.112.204.140, 49 ... Open route1#telnet 10.11.19.14 49 Trying... (1 Reply)
Discussion started by: popeye
1 Replies

8. Shell Programming and Scripting

Script to block IP with too many connections

Hello everyone. I'd really appreciate some help on this since someone is ddosing or doing something to cause our server to overload. It happens once a day and always from the same isp. I've reported it to abuse email of this isp but they don't seem to care. It happens once a day. And... (0 Replies)
Discussion started by: thesting
0 Replies

9. Shell Programming and Scripting

A bi directional script that will monitor the TCP/IP connections between two physical

Dear All , I'm looking for a unix script that will monitor the TCP/IP connections between two physical ip addresses and when it dectes an IP is down it generates an alarm and sends SMS to mobile numbers. Can any one help, I need this urgently. Waiting for positive replies.. ... (3 Replies)
Discussion started by: samura
3 Replies

10. Solaris

rlogin, telnet connections timeout

Hi, I have a Sun Ultra 5 desktop with Solaris 8. When I telnet/rlogin into any other host, the connection closes after few hours of inactivity. I also have another Windows box which I use rarely. But when I telnet/rlogin into the same hosts using putty, the connection stays for days without any... (5 Replies)
Discussion started by: dr_gsb
5 Replies
Login or Register to Ask a Question
cconsole(1M)						  System Administration Commands					      cconsole(1M)

NAME
cconsole , crlogin, cssh, ctelnet - multi window, multi machine, remote console, login, ssh, and telnet commands SYNOPSIS
$CLUSTER_HOME/bin/cconsole [-s] [ -l username] [clustername... | nodename...] $CLUSTER_HOME/bin/crlogin [-l username] [clustername... | nodename...] $CLUSTER_HOME/bin/cssh [-l username] [-p ssh-port] [clustername... | nodename...] $CLUSTER_HOME/bin/ctelnet [clustername... | nodename...] DESCRIPTION
These utilities initiate a multiple window connection to a set of specified hosts. There are three variations: one that is specifically intended for remote console access while the others provide remote logins using rlogin, ssh, or telnet. Each utility starts a host window for each of the specified hosts, as well as a common window. Input directed into the common window is sent to each of these host windows. This tool is useful for system administration tasks that require similar things to be done on each of several hosts. For tasks that are identical on all hosts, typing in the common window sends the characters to all of the hosts. However, the host windows are normal terminal windows so they can also be used one at a time (by moving the mouse into one of them and typing directly into it) to perform host specific tasks. The common window also allows the user to select which hosts receive the characters typed in the common window, so only the specified hosts will receive input. These utilities use entries in two different databases, /etc/clusters and /etc/serialports. cconsole The cconsole command provides remote console access through the telnet command. All normal telnet escape characters are available to the user. See the telnet(1) man page for a complete listing of telnet escape characters. Because there are a few telnet escapes that are com- monly used, they are provided here as well. The escape character is Control-], specified below as ^]. ^] quit Quit the session. Analogous to ~. in tip and rlogin. ^] send brk Send a break signal to the remote system. This is what is needed to halt the Sun CPU. The normal key board sequence is "L1-A." crlogin The crlogin utility provides remote login through the rlogin command to multiple cluster nodes. cssh The cssh utility establishes Secure Shell connections directly to the cluster nodes through the ssh command. ctelnet The ctelnet utility is similar to cconsole except that the connection is directly over the Internet. OPTIONS
The following options are supported: -l username Specifies the user name for the ssh connection. This option is passed to the cconsole, crlogin, or cssh utility when the utility is launched from the CCP. The ctelnet utility ignores this option. If the -l option is not specified, the user name that launched the CCP is effective. -p ssh-port Specifies the Secure Shell port number to use. This option is passed to the cssh utility when the utility is launched from the CCP. The cconsole, crlogin, and ctelnet utilities ignore this option, If the -p option is not specified, the default port number 22 is used for secure connections. -s Specifies using Secure Shell connections to node consoles instead of telnet connections. This option is passed to the cconsole utility when the utility is launched from the CCP. The crlogin, cssh, and ctelnet utilities ignore this option. If the -s option is not specified, the cconsole utility uses telnet connections to the consoles. To override the -s option, deselect the Use SSH checkbox in the Options menu of the cconsole graphical user interface (GUI). ENVIRONMENT VARIABLES
The following environment variables affect the execution of these utilities: CLUSTER_HOME Location of Sun Cluster System tools. Defaults to /opt/SUNWcluster. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWccon | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
rlogin(1), ssh(1), telnet(1), tip(1), ccp(1M), chosts(1M), cports(1M), clusters(4), serialports(4), attributes(5) NOTES
The standard set of X Window System command line arguments are accepted. Sun Cluster 3.2 8 Sep 2007 cconsole(1M)