Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
> A ssh node problem in the shell
ytyyutianyun
post Nov 16 2011, 01:47 AM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 5
Joined: 16-November 11
Member No.: 15,690



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 &
Go to the top of the page
 
+Quote Post
 
Start new topic
Replies
michaelk
post Nov 16 2011, 07:05 AM
Post #2


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,797
Joined: 23-January 03
Member No.: 360



Basically when you run ssh it starts another tty so the commands following ssh are never executed.
You can run commands from ssh like

ssh -n -f node1 "sh -c \"cd /us1; nohup matlab <pi11081.m> name.out &\""
Go to the top of the page
 
+Quote Post
ytyyutianyun
post Nov 16 2011, 10:46 PM
Post #3


Whats this Lie-nix Thing?
*

Group: Members
Posts: 5
Joined: 16-November 11
Member No.: 15,690



QUOTE (michaelk @ Nov 16 2011, 07:05 AM) *
Basically when you run ssh it starts another tty so the commands following ssh are never executed.
You can run commands from ssh like

ssh -n -f node1 "sh -c \"cd /us1; nohup matlab <pi11081.m> name.out &\""



Thanks!
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.
And someone else ask me to do like this:


ssh node1 << EOF
cd /us1
nohup matlab < pi11081.m >& name.out &
cd /us2
nohup matlab < pichuli2.m >& name.out &
exit
EOF



Last of all, thanks
Go to the top of the page
 
+Quote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 20th October 2017 - 10:11 PM