On Tue, Aug 26, 2014 at 11:42 PM, Douglas A. Augusto
<daaugu...@gmail.com> wrote:
> On 25/08/2014 at 21:41,
:
> I'd like, though, to propose some modifications to the script. Here is the
> modified script:
>
>    cat original.slf > updated.slf

'cat' is bad. See below.

>       nice parallel --timeout 10 --nonall -j0 -k --slf original.slf --tag 
> echo | sed -e 's/\t$//' -e '/\t/d' > tmp.slf

Maybe --timeout 1000% would make more sense: We do not know if these
machines are spread all over the world (or if it is done through Tor)
and whether 10 seconds is enough, but I would imagine that 10 times
the median value would always be enough.

>          cat tmp.slf > updated.slf

'cat' is not atomic, so you will be inviting a race condition, where
the 'cat' runs exactly when GNU Parallel reads the file. 'mv' is
atomic - use that instead.

Think of how you can automatically start the script when GNU Parallel
is started, and stop when GNU Parallel stops. Maybe something like:

   parallel_daemon start --slf original.slf
   parallel --slf $UPDATED_SLF  ...
   parallel_daemon stop

Or even:

   parallel_with_daemon --slf original.slf [... other parallel options ...]

How is cleanup done? How is cleanup done if the user presses Ctrl-C?

What happens if the users run multiple instances? With different original.slf?


/Ole

Reply via email to