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
DBX_FETCH_ROW(3)							 1							  DBX_FETCH_ROW(3)

dbx_fetch_row - Fetches rows from a query-result that had the DBX_RESULT_UNBUFFEREDflag set

SYNOPSIS
mixed dbx_fetch_row (object $result_identifier) DESCRIPTION
dbx_fetch_row(3) fetches rows from a result identifier that had the DBX_RESULT_UNBUFFERED flag set. When the DBX_RESULT_UNBUFFERED is not set in the query, dbx_fetch_row(3) will fail as all rows have already been fetched into the results data property. As a side effect, the rows property of the query-result object is incremented for each successful call to dbx_fetch_row(3). PARAMETERS
o $result_identifier - A result set returned by dbx_query(3). RETURN VALUES
Returns an object on success that contains the same information as any row would have in the dbx_query(3) result data property, including columns accessible by index or fieldname when the flags for dbx_query(3) were set that way. Upon failure, returns 0 (e.g. when no more rows are available). EXAMPLES
Example #1 How to handle the returned value <?php $result = dbx_query($link, 'SELECT id, parentid, description FROM table', DBX_RESULT_UNBUFFERED); echo "<table> "; while ($row = dbx_fetch_row($result)) { echo "<tr> "; foreach ($row as $field) { echo "<td>$field</td>"; } echo "</tr> "; } echo "</table> "; ?> SEE ALSO
dbx_query(3). PHP Documentation Group DBX_FETCH_ROW(3)
All times are GMT -4. The time now is 06:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy