The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > Linux
.
google unix.com



Linux RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to set timeout? uativan Shell Programming and Scripting 14 02-02-2009 02:28 AM
RPC Timeout darren.wyatt Red Hat 1 09-09-2008 12:14 PM
ssh/scp - can you specify timeout? frustrated1 Shell Programming and Scripting 3 01-02-2008 07:57 PM
About the Timeout lyh003473 SUN Solaris 4 07-24-2004 09:12 PM
timeout csaunders HP-UX 5 02-27-2004 10:54 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-27-2009
John101 John101 is offline
Registered User
  
 

Join Date: Sep 2009
Posts: 2
RSH Timeout

Hi All

I have a nice little script that i have written in Perl, in it use RSH ( yes i know it is i should being using ssh, but it i secure network it is being run on) the idea of the script it that it will RSH into a machine and then follow out a command, the problem i am running into is if the RSH deamon for what ever reason as stopped working on the machine, the script will keep trying to accsess the machine for a few mins and then move onto the next, is there a way to add a timeout, so if the connect is not made in say 30 seconds it will move on

thanks


John
  #2 (permalink)  
Old 09-27-2009
gowri_g_s gowri_g_s is offline
Registered User
  
 

Join Date: Sep 2009
Posts: 15
I would try to do the following (Im a beginner ) -

Code:

CHK=`ssh2 -q <IP> "ps -ef | grep rshd | grep -v grep"`  

if [ $CHK -eq 0 ]; then
    sleep 30
    CHK=`ssh2 -q <IP> "ps -ef | grep rshd | grep -v grep"`
    
   if [ $CHK -ne 0 ];then
      //call your script here
   else
     //rshd in remote sys is not up
    //do what you want to
   fi
else
  //rshd running - call your script here too
fi
  #3 (permalink)  
Old 09-27-2009
John101 John101 is offline
Registered User
  
 

Join Date: Sep 2009
Posts: 2
i could be wrong but is that not just using ssh instead to check to make sure rsh is running??

I do not really care that it is not running, i just want the script to pass over that machine and carry on with the other machines in the list.
thanks

John
  #4 (permalink)  
Old 09-27-2009
pludi's Avatar
pludi pludi is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2008
Location: .at
Posts: 1,839
rsh itself apparently doesn't support a timeout. If you've got netcat available, you could use this
Code:
netcat -z -w 3 remote 514
and check $?.
Or use IO::Socket::INET to open a connection yourself with a timeout and check that.
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:17 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0