Help!A ssh node problem in the shell
I want to enter the command step by step automatically with a shell
when I run the shell,the program only jump to ssh node1,and do nothing else. Help and thanks. Here is the program: #!/bin/bash ssh node1 cd /us1 nohup matlab < pi11081.m >& name.out & cd /us2 nohup matlab < pichuli2.m >& name.out & ssh node2 cd /us1 nohup matlab < pichuli3.m >& name.out & cd /us2 nohup matlab < pichuli4.m >& name.out & ssh node3 cd /us1 nohup matlab < pichuli5.m >& name.out & cd /us2 nohup matlab < pichuli6.m >& name.out & |
That's correct. The first ssh statement does only a login to node1 and then sticks waiting for user input at the prompt of node1 itself. Instead if you want to pass some command to be executed on node1 you need to specify them as standard input and don't forget the exit command to terminate the ssh session. For multiple commands you can try a here document:
Code:
#!/bin/bash |
Quote:
Thanks! You are great.it's helpful. When I posted this, I continued searching some solutions and find "rsh" can do my thing. But I only can execute only one command and maybe I will learn it. Last of all, thanks |
There's another way if the 'at' service is running: save the script on the node then 'at -f /path/to/script'.
|
All times are GMT -5. The time now is 08:19 AM. |