Sponsored Content
Full Discussion: telnet to another server
Top Forums Shell Programming and Scripting telnet to another server Post 302331347 by kshji on Monday 6th of July 2009 01:26:14 AM
Old 07-06-2009
Ex. ping is not service test. If you like to test some tcp/ip service, use that service = only correct method to check service.
And use ip and port/service number - test only service, not own dns, ...
Create socket ex. socket.sh 111.111.111.111 23
Code:
#!/usr/bin/ksh
host=$1
port=$2
exec 4<>/dev/tcp/$host/$port
exit $?

Using that nice ksh93 script, you can do something like (check.sh):
Code:
#!/usr/bin/ksh
ip=$1
port=$2
waittime=$3
while true 
do
        ./socket.sh  "$ip" "$port"  ||  ./not_ok.sh "$ip" "$port"
        sleep $waittime
done

Code:
chmod a+rx *.sh
# ex. port 23 = usually telnet, wait 300 s
./check.sh  xx.xxx.xxx.xx  23 300 >> telnet.log 2>&1     &

Now you can write your not_ok.sh script as you like.

Last edited by kshji; 07-06-2009 at 02:32 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Telnet Server

Good day, We have recently purchased an HP Compaq t5000 thin client and installed this as a management console. It runs Windows CE 5.0 as we required Internet Explorer for the managemenet of the one server (Web based management only working in Internet Explorer). We have now also installed... (4 Replies)
Discussion started by: avd
4 Replies

2. UNIX for Advanced & Expert Users

I access to my server via Telnet

I use server Unix with AIX 5.2. I can't telnet to server about 5 mn, then i can access to server via telnet. This problem have again and again. Sometime can, sometime can't. I dont know why? Do you have any idea? (4 Replies)
Discussion started by: SENG
4 Replies

3. UNIX for Dummies Questions & Answers

telnet to remote server

Hi every1 well i am new to unix scripting but i have been seeking help from this forum the question i want to write a script to telnet to a remote server and put the username and pwd in the script the problem is that i want to run some commands on the remote server and get the results in a... (2 Replies)
Discussion started by: hassanabbas
2 Replies

4. Solaris

cannot telnet after restarting server

Dear guys, Pls help me this case. I telnet normally to Solaris. After restarting it manually, I can only console, cannot telnet from my latop although I can ping it. I checked /etc/default/login /usr/sbin/in.telnetd /etc/inet/inetd.conf All these files are the same. I don't see telnet... (2 Replies)
Discussion started by: wipi
2 Replies

5. AIX

Unable to telnet to server

Hi, I encountered error when I telnet to my server. Error is as follows: telnetd: /bin/login: The file access permissions do not allow the specified action I am able to ssh into my server and I have checked/verified /etc/security and /etc/inetd.conf. I restarted the inetd subsystem via... (1 Reply)
Discussion started by: chongkls77
1 Replies

6. Shell Programming and Scripting

How to auto telnet the server from another server using script

Hi All, I have a problem with auto telnet script, but I want to tell u something a) I am only a member access on the server, so not able to access 'root' account b) not able to install any software on server 3) On server, there is not install 'except' I have to write a script, which is ran... (0 Replies)
Discussion started by: atul9806
0 Replies

7. Homework & Coursework Questions

How to auto telnet the server from another server

Hi All, I have a problem with auto telnet script, but I want to tell u something a) I am only a member access on the server, so not able to access 'root' account b) not able to install any software on server 3) On server, there is not install 'except' 1. The problem statement, all variables... (0 Replies)
Discussion started by: atul9806
0 Replies

8. Homework & Coursework Questions

How to auto telnet the server from another server?

Hi All, I have a problem with auto telnet script, but I want to tell u something a) I am only a member access on the server, so not able to access 'root' account b) not able to install any software on server 3) On server, there is not install 'except' 1. The problem statement, all variables... (8 Replies)
Discussion started by: atul9806
8 Replies

9. UNIX for Dummies Questions & Answers

Telnet server

I need a list of servers, that, I can try out my test program with, such as a timeserver. For example, I would need to connect to telnet server|port. (1 Reply)
Discussion started by: jon80
1 Replies

10. SCO

Not able to telnet to server

Out of the blue for some odd reason I am no longer able to telnet to one of my SCO Unix servers. I can ping, ftp and do a traceroute to it, just cant telnet. When I attempt to telnet to it, I just get this Trying ##.##.##.##.... telnet: Unable to connect to remote host: Connection timed out ... (0 Replies)
Discussion started by: macastor
0 Replies
mconnect(1)							   User Commands						       mconnect(1)

NAME
mconnect - connect to SMTP mail server socket SYNOPSIS
mconnect [-p port] [-r] [hostname] DESCRIPTION
The mconnect utility opens a connection to the mail server on a given host, so that it can be tested independently of all other mail soft- ware. If no host is given, the connection is made to the local host. Servers expect to speak the Simple Mail Transfer Protocol (SMTP) on this connection. Exit by typing the quit command. Typing EOF sends an end of file to the server. An interrupt closes the connection immedi- ately and exits. OPTIONS
The following options are supported: -pport Specify the port number instead of the default SMTP port (number 25) as the next argument. -r Raw mode: disable the default line buffering and input handling. This produces an effect similar to telnet(1) to port number 25. OPERANDS
The following operand is supported: hostname The name of a given host. USAGE
The mconnect command is IPv6-enabled. See ip6(7P). FILES
/etc/mail/sendmail.hf Help file for SMTP commands ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWsndmu | +-----------------------------+-----------------------------+ SEE ALSO
telnet(1), sendmail(1M), attributes(5), ip6(7P) Postel, Jonathan B., RFC 821, Simple Mail Transfer Protocol, Information Sciences Institute, University of Southern California, August 1982. SunOS 5.11 28 Jan 2008 mconnect(1)
All times are GMT -4. The time now is 03:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy