I logged in through a command shell on a Linux system and entered a command:
nohup rsync ... >my.log &2>1
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" ?
Matthew
|
|
0
|
|
|
|
Reply
|
kmlincoln100
|
5/18/2008 5:26:25 PM |
|
Matthew Lincoln schreef:
> I logged in through a command shell on a Linux system and entered a command:
>
> nohup rsync ... >my.log &2>1
>
> 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" ?
>
> Matthew
try:
rsync ... >my.log 2>&1 &
--
Luuk
|
|
0
|
|
|
|
Reply
|
luuk (813)
|
5/18/2008 5:35:05 PM
|
|
Matthew Lincoln schrieb:
> I logged in through a command shell on a Linux system and entered a command:
>
> nohup rsync ... >my.log &2>1
>
You need to append & on the end like:
nohup rsync ... >my.log &2>1 &
That way, the process is started in background
or you can stop the running process with Ctrl+Z and then resume it
in background with bg <jobnumber>
Greets
Chris
|
|
0
|
|
|
|
Reply
|
user3 (1483)
|
5/18/2008 6:50:00 PM
|
|
On 2008-05-18, Matthew Lincoln <kmlincoln100@hotmail.com> wrote:
>
>
> I logged in through a command shell on a Linux system and entered a command:
>
> nohup rsync ... >my.log &2>1
>
> 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" ?
>
You have to add "&" to run the command in the background.
|
|
0
|
|
|
|
Reply
|
marcumbill (1012)
|
5/18/2008 7:19:03 PM
|
|
Matthew Lincoln wrote:
> I logged in through a command shell on a Linux system and entered a command:
>
> nohup rsync ... >my.log &2>1
>
> 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" ?
>
> Matthew
Two problems:
"nohup" does not put jobs into the background automatically.
So to get back the prompt you need to add '&' at the end of
the command line.
nohup currently doesn't close stdin, so your session may hang
when you attempt to log out. This is fixed in the next version
of the POSIX/SUS (and I believe Gnu nohup already), but it
can't hurt to make sure.
So you should run this command as:
nohup rsync ... </dev/null &
There is no need to redirect either stdout or stderr, as
nohup will do that for you, to the file ./nohup.out. But
if you want to redirect the output yourself, please note
the correct syntax is "... 2>&1" and not "... &2>1".
Hope this helps!
-Wayne
|
|
0
|
|
|
|
Reply
|
nospam53 (37)
|
5/18/2008 8:00:48 PM
|
|
On Sun, 18 May 2008 17:26:25 +0000, Matthew Lincoln rearranged some
electrons to say:
> I logged in through a command shell on a Linux system and entered a
> command:
>
> nohup rsync ... >my.log &2>1
>
> 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" ?
>
> Matthew
Try running it in the background... &
|
|
0
|
|
|
|
Reply
|
none18 (390)
|
5/18/2008 8:05:48 PM
|
|
Matthew Lincoln wrote:
> I logged in through a command shell on a Linux system and entered a
> command:
>
> nohup rsync ... >my.log &2>1
Shouldn't that be ... 2>&1?
>
> 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" ?
Because nohup doesn't put it into the background, you'd still need & for
that.
nohup rsync ... >my.log 2>&1 &
Bye, Jojo
|
|
0
|
|
|
|
Reply
|
nospam.jojo (1344)
|
5/19/2008 6:30:32 AM
|
|
Matthew Lincoln wrote:
> I logged in through a command shell on a Linux system and entered a command:
>
> nohup rsync ... >my.log &2>1
>
> 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" ?
>
> Matthew
nohup does not run commands in the background.
"man nohup" will tell you what it does.
Robert
|
|
0
|
|
|
|
Reply
|
robert.f.harris (386)
|
5/19/2008 8:10:50 AM
|
|
--Signature=_Mon__19_May_2008_11_29_40_+0200_yC0Qlu4ejb=A1KOS
Content-Type: text/plain; charset=US-ASCII
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Matthew Lincoln wrote:
> I logged in through a command shell on a Linux system and entered a
> command:
>=20
> nohup rsync ... >my.log &2>1
First of all: You mean 2>&1, right?
> I expected that after the command issue the command prompt
>=20
> ml@server [/]#
>=20
> gets visible again.
>=20
> But the ssh terminal is blocked as if I would have NOT entered
> "nohup".
>=20
> 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.
--Signature=_Mon__19_May_2008_11_29_40_+0200_yC0Qlu4ejb=A1KOS
Content-Type: application/pgp-signature
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFIMUiO5jrP7hWxSO8RApemAKCEqor01tyRDWOedno0oU6Ox9xtwwCfaKPT
emawB/cZV+V694TY7r+my7s=
=0Lob
-----END PGP SIGNATURE-----
--Signature=_Mon__19_May_2008_11_29_40_+0200_yC0Qlu4ejb=A1KOS--
|
|
0
|
|
|
|
Reply
|
tn (18)
|
5/19/2008 9:29:40 AM
|
|
On 2008-05-18 19:26, Matthew Lincoln wrote:
> I logged in through a command shell on a Linux system and entered a command:
>
> nohup rsync ... >my.log &2>1
>
> 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" ?
>
> Matthew
Nohup don't run things in background, it just use /dev/null as input, and
some other things, so you can logout while you run it in background.
In your case the output redirection is still done by your current shell, and
not by nohup.
To understand what I mean, do ssh othermachine df >df.out , and you will find
df.out on your local machine, not on the remote machine, while
ssh othermachine 'df > df.out' will create df.out on the remote machine.
eg, try something like:
(nohup rsync ... >my.log &2>1) &
Or just nohup rsync ... & , and use the default nohup.out
Or , just make a script, like this:
#!/bin/bash
(
rsync .......
) >my.log &2>1
And just do nohup script &
/bb
|
|
0
|
|
|
|
Reply
|
spamtrap18 (231)
|
5/19/2008 12:41:15 PM
|
|
On 18 May 2008 17:26:25 GMT, kmlincoln100@hotmail.com (Matthew
Lincoln) wrote:
>I logged in through a command shell on a Linux system and entered a command:
>
>nohup rsync ... >my.log &2>1
>
>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" ?
>
>Matthew
Couple of problems here...
>nohup rsync ... >my.log &2>1
nohup does not put a command into the background, & does
&2>1 will create a file called 1
I think what you are looking for is something like:
nohup rsync <rsync options> >my.log 2>&1 &
Scott McMillan
|
|
0
|
|
|
|
Reply
|
smcmillan (35)
|
5/19/2008 2:28:12 PM
|
|
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.
|
|
0
|
|
|
|
Reply
|
tn (18)
|
5/19/2008 7:57:57 PM
|
|
On 2008-05-18, Matthew Lincoln <kmlincoln100@hotmail.com> wrote:
> nohup rsync ... >my.log &2>1
> I expected that after the command issue the command prompt
> But the ssh terminal is blocked as if I would have NOT entered "nohup".
nohup doesn't run the command in the backgound, but it stops the script
from exiting when you log out of the shell.
Try:
nohup rsync ... >my.log 2>&1 &
2>&1 redirects stderr to the same place stdout is going
the & at the end puts the command in the background.
Regards,
Ian.
|
|
0
|
|
|
|
Reply
|
ipetts1 (10)
|
5/20/2008 3:49:59 AM
|
|
On 2008-05-19 14:41, birre wrote:
> On 2008-05-18 19:26, Matthew Lincoln wrote:
>> I logged in through a command shell on a Linux system and entered a
>> command:
>>
>> nohup rsync ... >my.log &2>1
>>
>> 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" ?
>>
>> Matthew
>
> Nohup don't run things in background, it just use /dev/null as input, and
> some other things, so you can logout while you run it in background.
>
> In your case the output redirection is still done by your current shell,
> and
> not by nohup.
>
> To understand what I mean, do ssh othermachine df >df.out , and you will
> find
> df.out on your local machine, not on the remote machine, while
> ssh othermachine 'df > df.out' will create df.out on the remote machine.
>
> eg, try something like:
> (nohup rsync ... >my.log &2>1) &
>
> Or just nohup rsync ... & , and use the default nohup.out
>
> Or , just make a script, like this:
> #!/bin/bash
> (
> rsync .......
> ) >my.log &2>1
>
> And just do nohup script &
>
> /bb
Sorry, I didn't see the &2>1 thing :-(
Yes, it is 2>&1
/bb
|
|
0
|
|
|
|
Reply
|
spamtrap18 (231)
|
5/20/2008 12:21:32 PM
|
|
Matthew Lincoln a dit le 05/18/2008 07:26 PM:
> I logged in through a command shell on a Linux system and entered a command:
>
> nohup rsync ... >my.log &2>1
If you use bash, you have a syntax error. Use:
$ nohup rsync ... >my.log 2>&1 &
or quicker:
$ nohup rsync &> my.log &
see more here: http://www.tldp.org/LDP/abs/html/io-redirection.html
--
Patrick CAO HUU THIEN
email: patrick point cao_huu_thien arobase upmc point fr
gpg key ID: 1024D/58D16D27 sur pgp.mit.edu
fingerprint: D7B8 7DFB 479C A02E 48A2 383C 0005 4A33 58D1 6D27
|
|
0
|
|
|
|
Reply
|
patrick.cao_huu_thien (1)
|
5/23/2008 3:07:53 PM
|
|
In article <20080519215757.be27da03.tn@movb.de>,
Tobias Nissen <tn@movb.de> wrote:
> Matthew Lincoln wrote:
[ snip ]
> > 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 ... &
A belated possibly-nitpick: Doesn't rsync run as a separate process
in any case? and what the ampersand does it allow the original (shell)
process to continue without waiting for the rsync process to finish?
[ snip ]
--
B. L. Massingill
ObDisclaimer: I don't speak for my employers; they return the favor.
|
|
0
|
|
|
|
Reply
|
blmblm (1187)
|
5/24/2008 6:59:25 PM
|
|
|
15 Replies
252 Views
(page loaded in 0.484 seconds)
Similiar Articles: how to resume a process to foreground after no-hup then disconnect ...... nohup myjob &" to prevent being accidentally disconnected... but once I got disconnected, and I log back, see my ... work ... my job is still running, but "jobs" simply does not ... comp.unix.programmer - page 12... 2 446 (7/21/2003 1:19:52 AM) Does anybody have a good tutorial for how SysV semaphores work ... not be available in nohup ... 1 167 (7/18/2003 2:20:25 PM) how to log all ... Problem with Openssh 4.2p1; libcrypto.so.0.9.8: Permission denied ...3) Latest version of zlib (1.2.1 or later I ... to all of the other systems that work. That is why I am scratching my head on ... ok, and all but one of the Solaris 8 ... rsync ... Crontab issues with Solaris 10 - comp.unix.solarisThe problem is, it doesn't work, the ... What does the cron log say? Check /var/cron/log ... whether crontab is calling it or not; 2) Remove the >/dev/null and 2>&1 ... Quickest way to bulk copy many files from one disk cluster to ...... don't know if that will work here. rsh does ... it in the foreground, rsync is very touchy with the shell it is running in. I tried running it with nohup, and it did not ... libiconv.so.2? - comp.unix.solaris... aka: Alan.Coopersmith@Sun.COM Working for, but definitely not speaking ... rsync solaris + ld.so.1: rsync: fatal: libiconv.so.2: open failed: Hi, OS=Sun 5.10 Generic ... Wrap a function - comp.lang.pythonOn 1/28/2010 2:24 PM, Joan Miller ... other", I started to working on this project (Scripy [1]) because I wanted to hacking cryptsetup in my ... from the shell, and log ... Best Solaris 9 Firewall - comp.unix.solaris... Sun Version is graphical driven and my server has no display. Does anyone ... right at this point, let alone get it to work ... from Solaris 2 ... bash, gzip, less, lsof, rsync ... Re: "nohup rsync ... >my.log &2>1" does not work - Der Keiler LinuxMatthew 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? Re: "nohup rsync ... >my.log &2>1" does not work - Der Keiler LinuxMatthew Lincoln wrote: I logged in through a command shell on a Linux system and entered a command: nohup rsync ... >my.log &2>1 I expected that after the command ... 7/24/2012 12:45:53 AM
|