SSH remote control question


 
Thread Tools Search this Thread
Operating Systems Linux SSH remote control question
# 1  
Old 05-08-2011
Data SSH remote control question

I am pretty new to linux so forgive me for asking a basic question :P

I am using SSH to control 40 machines. What i am trying to do is remotely bash a shell script on each machine. I am using a for loop to bash every script, code as follows.


code in host machine runallworkers.sh:
Code:
...

i=1

for each $ip[] in ip[]   #just for example, i have saved all ips in a array ip[]
do
SSH -i aaa.rsa ubuntu@${ip[]} 'bash /home/ubuntu/program/runworker.sh'
echo "running worker in node $i"
let i++
done
...

code in each runworker.sh in each worker machine:
Code:
./worker.pl 7000 &
#worker.pl is a socket server program. it takes the parameter 7000 to run. it listens to port 7000

i can manually bash the runworker.sh file in each worker machine. So the worker.pl file should work fine. I can use the for loop to do other stuff on each node, so the loop should work fine too.
But the problem occurs when i run the script in the host machine, it stop responding after the first bashing, so the loop can not go on... the screen shows something like this:

Code:
ubuntu@1.1.1.1:~$ bash runallworkers.sh
running worker in node 1


please someone help me out...
Thanks in advance!!
# 2  
Old 05-09-2011
The way you're starting your script has it wait for any child processes to return before it exits itself. You can circumvent that by running it as
Code:
nohup ./worker.pl 7000 &

.

Also, if you don't need a TTY attached to your process you can run ssh with the -T option, but that's optional.
# 3  
Old 05-09-2011
for BASH or KSH you should also add disown after that.
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. AIX

Need to remote control client's ssh session

Is there a way that I can remotely control a user's ssh session so I can see what they are doing and walk them through the problem they are having on my AIX based application? (2 Replies)
Discussion started by: De@nneG
2 Replies

2. Solaris

T3-2 Remote control Problem

Hi Peeps, Wondering if anyone can help me, trying to launch the remote console on a T3-2. When I select use serial redirection it comes up with a dialogue box that says. "The remote console application requires java 5.0. Please Download java from http://www.java.com" "Do you wish to... (1 Reply)
Discussion started by: callmebob
1 Replies

3. SuSE

Installin Suse 11 - Mouse issue using Remote Control

hi guys I want to exhaust all the possibilities so I'm going to ask this here I am installing a Suse 11 on IBM Blade Center using Remote Control. when using this is impossible to use the mouse I see the mouse but I have no control over it I try to move it but no way it moves to fast s no... (3 Replies)
Discussion started by: kopper
3 Replies

4. Solaris

how to login with ssh to remote system with out applying the remote root/usr password

how to login with ssh to remote system with out applying the remote root/user password with rlogin we can ujse .rhosts file but with ssh howits possible plz guide (2 Replies)
Discussion started by: tv.praveenkumar
2 Replies

5. UNIX for Dummies Questions & Answers

Remote control of cde desktop>?

Does anyone know if there is software out there top allow me to take remote control of a remote CDE desktop like using MS netmeeting? I do not mean mimick the window I mean take over/share the same session. Any help is appreciated (1 Reply)
Discussion started by: boat73
1 Replies
Login or Register to Ask a Question