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
MKTAP(1)																  MKTAP(1)

NAME
mktap - create twisted.servers SYNOPSIS
mktap [options] apptype [application_option]... mktap apptype --help DESCRIPTION
The --help prints out a usage message to standard output. --debug, -d Show debug information for plugin loading. --progress, -p Show progress information for plugin loading. --encrypted, -e Encrypt file before writing (will make the extension of the resultant file begin with 'e'). --uid, -u <uid> Application belongs to this uid, and should run with its permissions. --gid, -d <gid> Application belongs to this gid, and should run with its permissions. --append, -a <file> Append given servers to given file, instead of creating a new one. File should be be a tap file. --appname, -n <name> Use the specified name as the process name when the application is run with twistd(1). This option also causes some initialization code to be duplicated when twistd(1) is run. --type, -t <type> Specify the output file type. Available types are: pickle - (default) Output as a python pickle file. source - Output as a .tas (AOT Python source) file. apptype Can be 'web', 'portforward', 'toc', 'coil', 'words', 'manhole', 'im', 'news', 'socks', 'telnet', 'parent', 'sibling', 'ftp', and 'mail'. Each of those support different options. portforward options -h, --host <host> Proxy connections to <host> -d, --dest_port <port> Proxy connections to <port> on remote host. -p, --port <port> Listen locally on <port> web options -u, --user Makes a server with ~/public_html and ~/.twistd-web-pb support for users. --personal Instead of generating a webserver, generate a ResourcePublisher which listens on ~/.twistd-web-pb --path <path> <path> is either a specific file or a directory to be set as the root of the web server. Use this if you have a directory full of HTML, cgi, php3, epy, or rpy files or any other files that you want to be served up raw. -p, --port <port> <port> is a number representing which port you want to start the server on. -m, --mime_type <mimetype> <mimetype> is the default MIME type to use for files in a --path web server when none can be determined for a particular extension. The default is 'text/html'. --allow_ignore_ext Specify whether or not a request for 'foo' should return 'foo.ext'. Default is off. --ignore-ext .<extension> Specify that a request for 'foo' should return 'foo.<extension>'. -t, --telnet <port> Run a telnet server on <port>, for additional configuration later. -i, --index <name> Use an index name other than "index.html" --https <port> Port to listen on for Secure HTTP. -c, --certificate <filename> SSL certificate to use for HTTPS. [default: server.pem] -k, --privkey <filename> SSL certificate to use for HTTPS. [default: server.pem] --processor <ext>=<class name> Adds a processor to those file names. (Only usable if after --path) --resource-script <script name> Sets the root as a resource script. This script will be re-evaluated on every request. This creates a web.tap file that can be used by twistd. If you specify no arguments, it will be a demo webserver that has the Test class from twisted.web.test in it. toc options -p <port> <port> is a number representing which port you want to start the server on. mail options -r, --relay <ip>,<port>=<queue directory> Relay mail to all unknown domains through given IP and port, using queue directory as temporary place to place files. -d, --domain <domain>=<path> generate an SMTP/POP3 virtual maildir domain named "domain" which saves to "path" -u, --username <name>=<password> add a user/password to the last specified domains -b, --bounce_to_postmaster undelivered mails are sent to the postmaster, instead of being rejected. -p, --pop <port> <port> is a number representing which port you want to start the pop3 server on. -s, --smtp <port> <port> is a number representing which port you want to start the smtp server on. This creates a mail.tap file that can be used by twistd(1) telnet options -p, --port <port> Run the telnet server on <port> -u, --username <name> set the username to <name> -w, --password <password> set the password to <password> socks options -i, --interface <interface> Listen on interface <interface> -p, --port <port> Run the SOCKSv4 server on <port> -l, --log <filename> log connection data to <filename> ftp options -a, --anonymous Allow anonymous logins -3, --thirdparty Allow third party connections --otp Use one time passwords (OTP) -p, --port <port> Run the FTP server on <port> -r, --root <path> Define the local root of the FTP server --anonymoususer <username> Define the the name of the anonymous user manhole options -p, --port <port> Run the manhole server on <port> -u, --user <name> set the username to <name> -w, --password <password> set the password to <password> words options -p, --port <port> Run the Words server on <port> -i, --irc <port> Run IRC server on port <port> -w, --web <port> Run web server on port <port> AUTHOR
Written by Moshe Zadka, based on mktap's help messages REPORTING BUGS
To report a bug, visit http://twistedmatrix.com/bugs/ COPYRIGHT
Copyright (C) 2000-2008 Twisted Matrix Laboratories. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU- LAR PURPOSE. SEE ALSO
twistd(1) July 2001 MKTAP(1)