Automated telnet for testing servers
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:
VAR=`(sleep 5;echo quit) | (telnet mailserver.timbuktu.net 25 2>&- )` 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. VAR=`(sleep 5;echo -e '^]';sleep 1;echo quit) | (telnet arhqmg01.usarec.army.mil 25 2>&- )` 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. |
Quote:
surely you can set a timeout variable if the server does not respond in this given time, do something. |
Quote:
Jim C. |
Quote:
|
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.
:) |
All times are GMT -5. The time now is 03:04 PM. |