Ole, Taking this one step further, I know of course there are other ways to do this, but what about a way to have sem die if it cannot immediately acquire execute? Something like *--die_young* so that it could be used not only to serialize but to disallow a run if there is already a process running with the same lock_id.
#!/usr/bin/parallel --shebang-wrap --semaphore --fg -u --id lock_id *--die_young* /bin/bash echo "enter"$ exec sleep 5 echo "exit"$ Thanks again for your great work! Cheers, Bradley On Fri, Jan 2, 2015 at 1:44 AM, Bradley Asztalos <b...@customweather.com> wrote: > Ole, > > Thank you for the great product. It's a joy to use and thank you for > administering the forum so well. > > Cheers, > > Bradley Asztalos > > On Fri, Jan 2, 2015 at 1:29 AM, Bradley <b...@customweather.com> wrote: > >> Agreed "Doh!" >> >> >> >> > On Jan 2, 27 Heisei, at 12:48 AM, Ole Tange <o...@tange.dk> wrote: >> > >> > On Thu, Jan 1, 2015 at 10:54 PM, Bradley Asztalos >> > <b...@customweather.com> wrote: >> > >> >> But I'm wondering if it is possible to use shebang in this context as >> in: >> > >> > It is. >> > >> >> -------singleton.sh--------- >> >> >> >> #!/opt/local/bin/parallel --shebang-wrap /bin/bash --semaphore --fg -u >> --id >> >> lock_id >> >> echo "start" $$ >> >> sleep 10 >> >> echo "end" $$ >> >> >> >> --------- >> >> >> >> This does not work. Any ideas here? >> > >> > You are going to say 'Doh'. >> > >> > /bin/bash is not an argument for --shebang-wrap. It is the command you >> > want to be run. Also --semaphore --fg -u --id are not options for >> > bash. Swap them around and you are good: >> > >> > #!/opt/local/bin/parallel --shebang-wrap --semaphore --fg -u --id >> > lock_id /bin/bash >> > >> > (Here is where you say 'Doh'). >> > >> > >> > /Ole >> > >