Use ssh command to *invoke* long running process on remote machine. - SSH
This is a discussion on Use ssh command to *invoke* long running process on remote machine. - SSH ; Hi all, I'm wondering if I can use the ssh command in Ubuntu to invoke a long running process on a remote machine and when the process has been invoked to break the ssh connection. I am writing a python ...
| | LinkBack | Tools |
|
#1
| |||
| |||
| I'm wondering if I can use the ssh command in Ubuntu to invoke a long running process on a remote machine and when the process has been invoked to break the ssh connection. I am writing a python script that needs this functionality. What I've come up with (that doesn't work) is: ssh -i ~/ssh/backup_key user@140.203.3.143 "nohup python /home/user/ longProcess.py &" This allows me to ssh to the remote machine without a password, but the ssh connection doesn't break until the "longProcess.py" is finished. Hopefully somebody can give me a hint here. Thanks! |
|
#2
| |||
| |||
| sophie_newbie wrote: > Hi all, > > I'm wondering if I can use the ssh command in Ubuntu to invoke a long > running process on a remote machine and when the process has been > invoked to break the ssh connection. > > I am writing a python script that needs this functionality. > > What I've come up with (that doesn't work) is: > > ssh -i ~/ssh/backup_key user@140.203.3.143 "nohup python /home/user/ > longProcess.py &" > > > This allows me to ssh to the remote machine without a password, but > the ssh connection doesn't break until the "longProcess.py" is > finished. > > Hopefully somebody can give me a hint here. > > Thanks! Why not simply take the '&' off the end? |
|
#3
| |||
| |||
| Nico Kadel-Garcia >sophie_newbie wrote: >> Hi all, >> >> I'm wondering if I can use the ssh command in Ubuntu to invoke a long >> running process on a remote machine and when the process has been >> invoked to break the ssh connection. Usually "invoke" means "start running" What do you mean by "invoke"? >> >> I am writing a python script that needs this functionality. >> >> What I've come up with (that doesn't work) is: >> >> ssh -i ~/ssh/backup_key user@140.203.3.143 "nohup python /home/user/ >> longProcess.py &" >> >> >> This allows me to ssh to the remote machine without a password, but >> the ssh connection doesn't break until the "longProcess.py" is >> finished. >> >> Hopefully somebody can give me a hint here. >> >> Thanks! ssh user@140.203.3.143 screen -d -m python /home/user/longProcess.py >Why not simply take the '&' off the end? |
|
#4
| |||
| |||
| In article <6472a3f4-97c2-4d5b-a19e-01e232125f1e@u75g2000hsf.googlegroups.com> sophie_newbie > >What I've come up with (that doesn't work) is: > >ssh -i ~/ssh/backup_key user@140.203.3.143 "nohup python /home/user/ >longProcess.py &" > > >This allows me to ssh to the remote machine without a password, but >the ssh connection doesn't break until the "longProcess.py" is >finished. ssh -i ~/ssh/backup_key user@140.203.3.143 "nohup python \ /home/user/longProcess.py /dev/null 2>&1 &" (In case your remote shell is [t]csh, use ">& /dev/null" instead of ">/dev/null 2>&1".) This is probably in a FAQ somewhere - ssh(d) is waiting for your process to finish in case it wants to do some (I/)O that you want to catch - if its stdin/out/err is redirected away from the connection (actual files instead of /dev/null works fine too), there is nothing to wait for. --Per Hedeland per@hedeland.org |
|
#5
| |||
| |||
| Doesn't seem to make a difference... On Oct 24, 8:04*pm, Nico Kadel-Garcia > sophie_newbie wrote: > > Hi all, > > > I'm wondering if I can use the ssh command in Ubuntu to invoke a long > > running process on a remote machine and when the process has been > > invoked to break the ssh connection. > > > I am writing a python script that needs this functionality. > > > What I've come up with (that doesn't work) is: > > > ssh -i ~/ssh/backup_key u...@140.203.3.143 "nohup python /home/user/ > > longProcess.py &" > > > This allows me to ssh to the remote machine without a password, but > > the ssh connection doesn't break until the "longProcess.py" is > > finished. > > > Hopefully somebody can give me a hint here. > > > Thanks! > > Why not simply take the '&' off the end? |
|
#6
| |||
| |||
| On Oct 25, 11:13*am, p...@hedeland.org (Per Hedeland) wrote: > In article > <6472a3f4-97c2-4d5b-a19e-01e232125...@u75g2000hsf.googlegroups.com> > > sophie_newbie > > >What I've come up with (that doesn't work) is: > > >ssh -i ~/ssh/backup_key u...@140.203.3.143 "nohup python /home/user/ > >longProcess.py &" > > >This allows me to ssh to the remote machine without a password, but > >the ssh connection doesn't break until the "longProcess.py" is > >finished. > > ssh -i ~/ssh/backup_key u...@140.203.3.143 "nohup python \ > * /home/user/longProcess.py /dev/null 2>&1 &" > > (In case your remote shell is [t]csh, use ">& /dev/null" instead of > ">/dev/null 2>&1".) This is probably in a FAQ somewhere - ssh(d) is > waiting for your process to finish in case it wants to do some (I/)O > that you want to catch - if its stdin/out/err is redirected away from > the connection (actual files instead of /dev/null works fine too), there > is nothing to wait for. > > --Per Hedeland > p...@hedeland.org Thats great seems to do the job. |
« Previous Thread
|
Next Thread »
| Tools | |
| |
| | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How can get process id of a process running on remote machine. | unix | Unix | 2 | 11-23-2007 06:25 AM |
| Schedule long running process | unix | Weblogic | 0 | 10-10-2007 05:19 AM |
| Schedule long running process | unix | Weblogic | 0 | 10-10-2007 12:05 AM |
| how to invoke a series of long running commands in the background and at a low priority _clb_ | unix | Windows NT | 1 | 10-01-2007 10:20 PM |
| how to invoke a series of long running commands in the background and at a low priority _clb_ | unix | Windows NT | 1 | 10-01-2007 08:42 PM |
All times are GMT. The time now is 09:44 PM.
