Re: "nohup rsync ... >my.log &2>1" does not work



Matthew Lincoln wrote:
I logged in through a command shell on a Linux system and entered a
command:

nohup rsync ... >my.log &2>1

First of all: You mean 2>&1, right?

I expected that after the command issue the command prompt

ml@server [/]#

gets visible again.

But the ssh terminal is blocked as if I would have NOT entered
"nohup".

Why is the rsync command still running in foreground although I
prepended the command with "nohup" ?

Do you use the GNU version of hangup or something your shell has
builtin? The behaviour of GNU's hangup is not to spawn a seperate
process, but I don't know about the other implementations.

If you explicitly want to spawn a process, do so:

nohup rsync ... &

Recognize the ampersand at the end of the rsync-command.

Also, your redirection >my.log 2>&1 won't work as expected, because
nohup writes output to a file named 'nohup.out'.

Instead of nohup, you can also use screen with its detach and reattach
features.
.



Relevant Pages