how do i avoid system hang due to ssh in script?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how do i avoid system hang due to ssh in script?
# 1  
Old 09-03-2010
how do i avoid system hang due to ssh in script?

I have a script that collects data from about 200 servers using 'ssh'. The problem is that, process sometime hangs at some point stopping the execution of the script. Please give me some idea how can I force the execution to jump to the next step if there arises any problem !! Thanks for replies if any Smilie

Last edited by mdangol; 09-03-2010 at 01:08 PM..
# 2  
Old 09-03-2010
You can try running your ssh command in the background and then follow it by a loop. The loop keeps running as long as it sees the ssh command in a 'ps -al' listing.

However, the loop needs to have some type of time counter (use a combination of 'sleep' and a general count variable), and when that expires, it grabs the process ID of the ssh command and kills it.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Ssh fails due to argument position.

I have a constraint to follow organization policy. So i do not have much liberty. ssh -i /opt/nonprod user1@hostone -t bash works while ssh -i /opt/nonprod -t bash user1@hostone fails How can I get this to work when I am enforced to put -t bash before the user@hostname ? Will share debug... (3 Replies)
Discussion started by: mohtashims
3 Replies

2. Shell Programming and Scripting

SSH is failing due to unknown reason

Hi, I have setup keys between user1@server1 and user2@server2 however, the ssh is failing. server1 is Linux 3.10.0-514.6.2.el7.x86_64 #1 SMP whereas server2 is 5.10 Generic_150400-40 sun4v sparc sun4v I have checked port 22 to be open and keys to be correct. I also find the permissions... (3 Replies)
Discussion started by: mohtashims
3 Replies

3. Shell Programming and Scripting

Ssh failing due to Bad owner error

i am logged in with "user1" on host1. I m trying to ssh to host2 using user id "user2" $ ssh user2@host2 Bad owner or permissions on /home/user1/.ssh/config Question 1: Can you please tell me why am i getting the Bad owner permissions error on that directory ? Question 2: Where is it... (7 Replies)
Discussion started by: mohtashims
7 Replies

4. Programming

A system hang issue in porting an old fs to kernel 2.6.32.*

Hi, I ported a file system from Kernel version 2.6.18.* to 2.6.32.46 as VFS implementation has changed and prepare_write/commit_write are replaced by write_begin/write_end pairs. Implemented the feature by writing a wrapper for write_begin and write_end and calling original functions for... (0 Replies)
Discussion started by: Praveen_218
0 Replies

5. Shell Programming and Scripting

UNIX script abruptly ending due to ssh command

Below UNIX script abruptly ends while reading second line from file. When I comment 'ssh' command the script works as expected. I think I will have to run ssh command in a different process, but haven't got a handle yet as regards to how to do that. Any help in resolving this problem is highly... (1 Reply)
Discussion started by: jeeteshkc
1 Replies

6. Linux

Linux System became hang-up

Hi all, I am working on Red hat Linux 2.6 and I am trying to compile some java files and when I am trying to do it,it compiles some file and then became hang up and doesn't allow me to do any operation.. I write one ksh script to compile all files by this script and move those file in... (1 Reply)
Discussion started by: smartgupta
1 Replies

7. HP-UX

SSh session hang

Hello, When I connect to a HP-UX 11.23 and/or 11.31 after a time without activity, the session hang. There is not TMOUT stablished, and the session NOT finish, always keep hang after about 20min of inactivity period. Anyone knows if this problem is related to HP-UX or network... (1 Reply)
Discussion started by: RuBiCK
1 Replies

8. Shell Programming and Scripting

using SSH with my script and avoid logging in manually

Hi Guys. I have 3 variables $HOST $Username $Password I want to connect to a remote server using SFTP. usr/bin/sftp -o Cipher=blowfish $HostWhere do I put in the options for the username and pwd??? I have tried different ways and nothing works. It keeps coming back and promting me. ... (5 Replies)
Discussion started by: ramangill
5 Replies

9. Red Hat

system hang

Hello, I am having a HP proliant 350 G3 sever installed wih RedHat linux 9.0 when I enterd using any user(Except root) the server hanged after few seconds, also the folder icons are blacked out and the names of the folder icons are disapper. can any body help me. Ajay (1 Reply)
Discussion started by: ajay234
1 Replies

10. UNIX for Dummies Questions & Answers

System hang in New Kernel.

Im having a problem, Any want know why after ive upgrade from Linux 7.0 to 7.1 ( 2.4.2-2 ) My mouse is having problem. If i drag a content in my Desktop let say an icon suddently the mouse stops moving ( Hang / freeze ) i need to do a hard reboot everytime to make it comes to normal. If... (4 Replies)
Discussion started by: killerserv
4 Replies
Login or Register to Ask a Question