ping and telnet timeout


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ping and telnet timeout
# 1  
Old 07-20-2011
ping and telnet timeout

Hello,
I need help, I have the following which save in the result file ping and telnet:port test.

Basically the script works but I should implement a check on ping and telnet command so that ping has 5 seconds threshold and telnet (more important) 10 seconds. Over that threshold ping and telnet should be interrupted giving a negative answer. Can someone help me?

thank you



Code:
#!/bin/sh
DNS="10.0.0.1"
HTTP="80"
SMTPSERVER="10.33.23.32"
POPSERVER="10.33.23.54"
SMTP="25"
POP="110"
 
echo "++++START++++" >> result
if ping ${DNS} | grep -w "alive"
then
  echo "DNS * Test ping DNS:" " >> result; echo ${DNS} " is OK" >> result
else
  echo "DNS * Test ping DNS:" >> result; echo ${DNS} " is DOWN " >> result
fi
echo "++++END++++" >> result
echo >> result
echo "++++START++++" >> result
echo "SMTP Test:" >> result; echo "b" | telnet -e "b" ${SMTPSE
RVER} ${SMTP} && echo ${SMTPSERVER}:${SMTP} " is OK" >> result
echo "++++END++++" >> result
echo >> result
echo "++++START++++" >> result
echo "POP Test:" >> result; echo "b" | telnet -e "b" ${POPSERV
ER} ${POP} && echo  ${POPSERVER}:${POP}" is OK" >> result
echo "++++END++++" >> result


Last edited by pludi; 07-20-2011 at 11:54 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Able to ping the server but not able to login through putty it says network timeout

Able to ping the server but not able to login through putty it says network timeout Please assist (3 Replies)
Discussion started by: Vishal_dba
3 Replies

2. Shell Programming and Scripting

ping with timeout bash

Hi experts: I want to do below thing with bash if ping 192.168.0.1 sucussful then do somthing without delay, if ping failed within 20s, then kill ping and exit not sure this can use "alarm" to do this. any code will be welcome Thanks (1 Reply)
Discussion started by: yanglei_fage
1 Replies

3. AIX

High Ping Timeout

Hi All Unix Fellows... Any encounter high ping timeout in AIX Server ? I scheduled the job to ping all the same segments servers all the time for 2 days without terminate. Found sometimes there are time the ping timeout is quite high ie. 10000ms but most of time is 0ms. what cause this ? is... (2 Replies)
Discussion started by: ckwan
2 Replies

4. Solaris

solaris ping timeout

Hi, I have two solaris 9 servers on the same switch, primary int0: 10.35.65.51 int1: 10.35.65.53 warm standby int0: 10.35.65.52 int1: 10.35.65.54 Primary server communicates with the other for db replication on int0 interfaces. But meanwhile we are using web interface running... (8 Replies)
Discussion started by: magnimious
8 Replies

5. Linux

Telnet Timeout

is there a way to add a timeout parameter to telnet when connecting to any IP address? like, if this IP doesn't respond within 10 seconds, abort. thanks i'm looking for something like this: telnet gaggaga.com 443 -t 10 (3 Replies)
Discussion started by: SkySmart
3 Replies

6. 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

7. Solaris

Disable telnet timeout

Hi, Can someone help me how I can disable telnet timeout? I'm connecting remotely to some machines and after some time my telnet connection was closed. How can I disable this so that I'm always connected to those machines? Thanks! (2 Replies)
Discussion started by: ayhanne
2 Replies

8. AIX

how to change telnet timeout setting

Hi all Can any one solve my problem? I want to change the default timeout setting for telnet in aix, pls help me. (1 Reply)
Discussion started by: vjm
1 Replies

9. UNIX for Dummies Questions & Answers

solaris telnet idle timeout

I have put TMOUT=1800;export TMOUT in the /etc/profile, put it does not work, by the way the root default shell is sh. but I wana every one including root to terminate the session after setting idle for 1800 seconds. thank for the help. (1 Reply)
Discussion started by: kahn630
1 Replies

10. UNIX for Dummies Questions & Answers

telnet session timeout

hi, we can set something such that if the user has been idle for a while, it will auto disconnect. where to do so? thanks (6 Replies)
Discussion started by: yls177
6 Replies
Login or Register to Ask a Question