03-19-2009
Hi Pludi,
Thanks for the suggestion, if running bash. I think it is same by executing below command
for one by one(since I have hundred over telnet connection). The telnet connection port is
2071
% telnet 10.x.x.x 2071
for the bash command
exec 3>/dev/tcp/${10.x.x.x}/2071
if [ $? -eq 0 ]
then
echo "Telnet accepting connections"
else
echo "Telnet connections not possible"
fi
It seems like not working.
bash: /dev/tcp/${10.x.x.x}/2071: bad substitution.
Do you have any idea which can lead me to run the script in one shot, and the output is the hundred over telnet connection status. THanks in advance!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
i have a unix script that gives me the sysdate from the database EDNAMID.WORLD.What i want my script to do the following
1) Establish a database connection
2) if database connection is successfull then echo the message "Connected"
3) put the o/p of the Sql query in a spool file
4) then... (3 Replies)
Discussion started by: ali560045
3 Replies
2. Shell Programming and Scripting
I am writing a script to do some conditional logic based on the results of a connection test. I need to capture the output of netcat, the 3 expected conditions are as follows. I need to capture the output of this command. I could write this to a file, but I would like to do it clearer if possible.... (1 Reply)
Discussion started by: princeboot
1 Replies
3. Shell Programming and Scripting
I want to test if my host can connect to any of the following 10 hosts (192.168.1.0 to 192.168.1.9)
I didnt know which command i should use, so i chose ping. (i wonder if i should use tracepath or sth else)
my code is the following:
#!/bin/bash
clear
firstPart="192.168.1"
maxNum="9"
... (2 Replies)
Discussion started by: shadow_boi
2 Replies
4. Shell Programming and Scripting
How do I gain control of the "Connection closed by foreign host" message telnet yields when you connect to it in a shell script? I'm using the output:
#!/usr/local/bin/bash
count=$(ping -c 1 $1 | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }')
if ; then
echo "$1 PING "... (2 Replies)
Discussion started by: phpfreak
2 Replies
5. Shell Programming and Scripting
Hi,
I am running a shell script which will spawn the telnet and login.
But sometimes, the telnet session itself is not getting spawned.
My requirement is, if the telnet session is not spawned, the user must be notified that it failed.
Is there any command to capture the status of telnet... (2 Replies)
Discussion started by: merin
2 Replies
6. Shell Programming and Scripting
Hello;
I regularly run monitoring scripts over ssh to monitoring scripts
But whenever a server is hung or in maintenance mode, my script hangs..
Are there anyways to trap exit status and be on my way ??
Looked at the ssh manpage and all I can see is a "-q" option for quiet mode ..
Thank... (2 Replies)
Discussion started by: delphys
2 Replies
7. UNIX for Dummies Questions & Answers
Hello,
I need to test telnet connections using port number for few hosts.
Could you please help me?
Thanks !! (1 Reply)
Discussion started by: skhichi
1 Replies
8. Shell Programming and Scripting
Hello Everyone,
My following script is giving me problems, when the SIP trunk goes down and the telnet session is started and just when the command is about to complete the connection is closed then script restarts.
I have noticed that as soon the script types in "sys re" or "sys rebo" or... (6 Replies)
Discussion started by: jeetz
6 Replies
9. Shell Programming and Scripting
Hi there,
I'm very used to use set -e to break my scripts if any command exits with a non-zero status.
As a policy, I'm willingly expecting echo hello | grep a to break the script.
The commands test 1 -eq $1 && echo hello exits with a non-zero status if $1 is not 1. BUT... It doesn't break... (2 Replies)
Discussion started by: chebarbudo
2 Replies
10. UNIX for Beginners Questions & Answers
Hello,
I'm trying to learn and automate some tasks via a script, but my first ever script failed with "connection closed by foreign host" error. I checked the other discussions but it didn't help. Could you please help?
#!/bin/bash
( sleep 2
echo open x.x.x.x 23
sleep 2
echo user
sleep 2... (1 Reply)
Discussion started by: Myrtle
1 Replies
LEARN ABOUT DEBIAN
portslave
portslave(8) Portslave portslave(8)
NAME
portslave - terminal server program.
SYNOPSIS
portslave [+config-file] port|-
DESCRIPTION
This manual page documents briefly the portslave, program.
This program is a getty replacement that will run it's own version of pppd, the user can specify their user-name via a login: prompt or PPP
PAP negotiation.
After the username and password have been supplied the user will be authenticated by the RADIUS protocol.
OPTIONS
An optional first parameter is '+config-file' to specify an alternate config file. The default is /etc/portslave/pslave.conf .
The next parameter is either the port number or '-'. The value '-' means that portslave is to use it's controlling tty as the serial
device and inspect the config file to find the RADIUS port number which matches that. This was originally written for telnetd support
(telnetd puts a '-' as the first command line parameter) but can be used for other things.
To run over the telnet protocol put a config entry similar to the following in your inetd configuration:
telnet stream tcp nowait root /usr/sbin/tcpd /usr/sbin/in.telnetd -L /usr/sbin/portslave
Then in the pslave.conf file put a series of entries specifying every pseudo-tty device (either ptyp0, ptyp1, etc or pts/1, pts/2 etc
depending on which type of device naming you use). For the RADIUS port numbers which are to be used for telnet connections you must spec-
ify the initchat as an empty string.
If you want to run portslave over a clean TCP connection (no telnet protocol) then put the following in your inetd configuration:
telnet stream tcp nowait root /usr/sbin/tcpd /usr/sbin/portslave -
AUTHOR
This man page was written by Russell Coker <russell@coker.com.au>. May be freely used and distributed without restriction.
SEE ALSO
pslave.conf(5), pppd(8), ctlportslave(1) http://doc.coker.com.au/projects/portslave/
Russell Coker <russell@coker.com.au> 2010.03.30 portslave(8)