Hi, I wonder if I can use parallel to implement a "race" of jobs.
Following is what I want. Given X jobs, start them all in parallel. # cat jobs.txt | parallel -j$(cat jobs.txt | wc -l) The first one to finish is the winner. Kill all the rest, and report the winner somehow. (Would also be nice to accept a timeout value from the user, telling how long they are willing to wait. If nothing finishes within the timeout, there is no winner.) Bonus points: Wait for another while (possibly a function of the time winner takes, say 2x time-of-winner) then kill those jobs that aren't finished. I guess reporting the winner isn't that important, because the job itself can make sure it leaves a trace of whether it finished or not. What do you think, is this possible at all? Any input from the experienced hackers out there will be appreciated. Thanks, Ozgur.
