parallel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to use nohup with gnu parallel


From: Benjamin R. Haskell
Subject: Re: how to use nohup with gnu parallel
Date: Wed, 2 Feb 2011 03:26:37 -0500 (EST)
User-agent: Alpine 2.01 (LNX 1266 2009-07-14)

On Wed, 2 Feb 2011, Ole Tange wrote:

On Tue, Feb 1, 2011 at 7:59 PM, Shantanu Unknown wrote:
Hi,
I could not find any info on how to use nohup with gnu parallel?
is the correct usage
nohup cat filename|parallel <runjob> {}
or is it
cat filename|parallel  nohup <runjob> {}
or something else?

This works for me:

nohup cat filename|parallel <runjob> {} &

I would think the important part to make immune to HUP would be `parallel` itself. Plus `nohup` the command (rather than the shell builtin, which is rare, I think) operates on a single portion of a pipeline.

Also eliminating "useless use of cat"[1]:

nohup parallel <runjob> {} < filename &


Some simple test commands bear this out:

$ seq 1 5 > filename

$ nohup cat filename | parallel -j1 'sleep 10 ; echo {}' &
(close shell ; in another shell `ps -ef | grep parall` shows nothing)

$ cat filename | nohup parallel -j1 'sleep 10 ; echo {}' &
(close shell ; in another shell `ps -ef | grep parall` shows something)


If `cat` isn't really cat(1), and it generates enough data that parallel wouldn't read it instantly, it might need protection, too:

nohup complex command | nohup parallel <runjob> {} &


I am curious why you use nohup and not GNU Screen?
http://www.gnu.org/software/screen/

Sometimes `screen` is overkill, especially if the goal is really to just have something that survives a HUP from a crashed terminal. Sometimes it's not installed (`nohup` is sometimes even a shell builtin).

--
Best,
Ben

[1] http://en.wikipedia.org/wiki/Cat_(Unix)#Useless_use_of_cat

reply via email to

[Prev in Thread] Current Thread [Next in Thread]