On 27/08/2014 at 08:38, Ole Tange <o...@tange.dk> wrote: > '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.
Hi, You're right, I was afraid of some unintended side-effect like that. I'll think about the daemon thing. For now, this is the updated script: cp original.slf updated.slf while [ 1 ] ; do nice parallel --timeout 1000% --nonall -j0 -k --slf original.slf --tag echo | \ sed -e 's/\t$//' -e '/\t/d' > tmp.slf if ! cmp -s tmp.slf updated.slf; then mv tmp.slf updated.slf fi sleep 10 done & parallel --slf updated.slf ... And below a version that also preserves the server options if any (the full server entry), such as '8/server.net': cp original.slf updated.slf while [ 1 ] ; do nice parallel --timeout 1000% --nonall -j0 -k --slf original.slf --tag echo | \ sed -e 's/\t$//' -e '/\t/d' | \ nice parallel -k grep -m 1 -F {} original.slf > tmp.slf if ! cmp -s tmp.slf updated.slf; then mv tmp.slf updated.slf fi sleep 10 done & parallel --slf updated.slf ... -- Douglas A. Augusto