|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Assume I opened a SSH session to a remote Linux server.
I want to start a long running command on that remote system and put that command in background so that I can logout (from SSH session) while the command is still running and not aborted. Normally I would have to put the command in such a case in background by appending a " &" at the end of the command line. However this does not work if I redirect the output like in: rsync ...... >>logfile 2>&1 & I guess I have to mask the appended "&". How do I do this otherwise? Sabine |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
At 06 May 2008 21:20:51 GMT gizmo_3@yahoo.de (Sabine Elsner) wrote:
> > Assume I opened a SSH session to a remote Linux server. > > I want to start a long running command on that remote system and put that command in background > so that I can logout (from SSH session) while the command is still running and not aborted. > > Normally I would have to put the command in such a case in background by appending a " &" at the end > of the command line. However this does not work if I redirect the output like in: > > rsync ...... >>logfile 2>&1 & > > I guess I have to mask the appended "&". > > How do I do this otherwise? ssh remote.machine.whatever sh -c 'nohup rsync ...... >>logfile 2>&1 &' Note: 'logfile' lives on the remote machine's file system. You have to quote the whole command string and pass it to a 'super' shell, one that will exit once the background job fades into the background. nohup prevents the forked process from being killed when the parent (super) shell exits. > > Sabine > -- Robert Heller -- Get the Deepwoods Software FireFox Toolbar! Deepwoods Software -- Linux Installation and Administration http://www.deepsoft.com/ -- Web Hosting, with CGI and Database heller@deepsoft.com -- Contract Programming: C/C++, Tcl/Tk |
|
![]() |
| Outils de la discussion | |
|
|