Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
So I have a script that is supposed to check to see if a mail server is up and responsive. What I want to know is how I can send it the telnet escape character. I've tried:
This works BUT there is a problem as the mail server may have been accidentally firewalled off. If this happens, my automated checking script will hang. What I want to do is send the escape character so that the '>' prompt comes up. They I should be able to send it "quit" even if it is hung on not getting a response from the server.
The above doesn't work. telnet interprets CTRL+] as '^]' but you can't type '^]' and get the same effect. So I guess what I need is to send the actual keystrokes. Like echo "\somenumber" ; echo quit
So I have a script that is supposed to check to see if a mail server is up and responsive. What I want to know is how I can send it the telnet escape character. I've tried:
This works BUT there is a problem as the mail server may have been accidentally firewalled off. If this happens, my automated checking script will hang. What I want to do is send the escape character so that the '>' prompt comes up. They I should be able to send it "quit" even if it is hung on not getting a response from the server.
The above doesn't work. telnet interprets CTRL+] as '^]' but you can't type '^]' and get the same effect. So I guess what I need is to send the actual keystrokes. Like echo "\somenumber" ; echo quit
Jim C.
what kind of script is it>?
surely you can set a timeout variable
if the server does not respond in this given time, do something.
what kind of script is it>?
surely you can set a timeout variable
if the server does not respond in this given time, do something.
I figured this one out. echo '\033\ ' because, for the Solaris version of telnet, the quit command is ^\. telnet doesn't mind the space at the end and it keeps the ' from being escaped.
what kind of script is it>?
surely you can set a timeout variable
if the server does not respond in this given time, do something.
I forgot to mention. You can, of course, set a timeout environment variable but it was something I was avoiding because I might be throwing the commands in question over an SSH connection. The test has to be run from the perspective of the machine that needs access to the server in question.
Can I recommend you don't put emails in clear text like that, there are plenty of web bots that look for that and then your spam problem just gets worse.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.