Sponsored Content
Full Discussion: ping and telnet timeout
Top Forums Shell Programming and Scripting ping and telnet timeout Post 302540302 by marmellata on Wednesday 20th of July 2011 09:29:13 AM
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 10:54 AM..
 

10 More Discussions You Might Find Interesting

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

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

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

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

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

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

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

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

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

10. 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
OCF_PACEMAKER_PING(7)					      Pacemaker Configuration					     OCF_PACEMAKER_PING(7)

NAME
ocf_pacemaker_ping - node connectivity SYNOPSIS
[OCF_RESKEY_pidfile=string] [OCF_RESKEY_dampen=integer] [OCF_RESKEY_name=string] [OCF_RESKEY_multiplier=integer] [OCF_RESKEY_host_list=string] [OCF_RESKEY_attempts=integer] [OCF_RESKEY_timeout=integer] [OCF_RESKEY_options=string] [OCF_RESKEY_failure_score=integer] [OCF_RESKEY_debug=string] ping [start | stop | reload | monitor | meta-data | validate-all] DESCRIPTION
Every time the monitor action is run, this resource agent records (in the CIB) the current number of ping nodes the host can connect to. It is essentially the same as pingd except that it uses the system ping tool to obtain the results. SUPPORTED PARAMETERS
OCF_RESKEY_pidfile = string [/ping-] PID file OCF_RESKEY_dampen = integer [5s] Dampening interval The time to wait (dampening) further changes occur OCF_RESKEY_name = string [pingd] Attribute name The name of the attributes to set. This is the name to be used in the constraints. OCF_RESKEY_multiplier = integer [] Value multiplier The number by which to multiply the number of connected ping nodes by OCF_RESKEY_host_list = string [] Host list The list of ping nodes to count. OCF_RESKEY_attempts = integer [2] no. of ping attempts Number of ping attempts, per host, before declaring it dead OCF_RESKEY_timeout = integer [2] ping timeout in seconds How long, in seconds, to wait before declaring a ping lost OCF_RESKEY_options = string [] Extra Options A catch all for any other options that need to be passed to ping. OCF_RESKEY_failure_score = integer [] failure_score Resource is failed if the score is less than failure_score. Default never fails. OCF_RESKEY_debug = string [false] Verbose logging Enables to use default attrd_updater verbose logging on every call. AUTHOR
Andrew Beekhof <andrew@beekhof.net> Author. Pacemaker Configuration 06/10/2014 OCF_PACEMAKER_PING(7)
All times are GMT -4. The time now is 11:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy