[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: singleton for script with shebang
From: |
Shlomi Fish |
Subject: |
Re: singleton for script with shebang |
Date: |
Fri, 2 Jan 2015 09:14:21 +0200 |
Hi Bradley,
On Thu, 1 Jan 2015 13:54:57 -0800
Bradley Asztalos <brad@customweather.com> wrote:
> I have a simple script, foo.sh::
>
> #!/bin/bash
> echo "start" $$
> sleep 10
> echo "end" $$
>
> I can run make sure this runs as a singleton with
>
> sem --fg -u --id lock_id ./foo.sh
>
> But I'm wondering if it is possible to use shebang in this context as in:
>
> -------singleton.sh---------
>
> #!/opt/local/bin/parallel --shebang-wrap /bin/bash --semaphore --fg -u --id
> lock_id
> echo "start" $$
> sleep 10
> echo "end" $$
>
> ---------
>
parallel is written in Perl 5 and uses «#!/usr/bin/perl» or whatever as a
shebang. As a result it cannot be itself used as a she-bang processor.
Furthermore, I should note that in programming, it is a good idea to stick to
the https://en.wikipedia.org/wiki/KISS_principle and not try to be as clever as
possible.
Hope it helps.
Regards,
Shlomi Fish
> This does not work. Any ideas here?
>
> Bradley
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
The Human Hacking Field Guide - http://shlom.in/hhfg
A kid always wishes they were older until they are 18. Afterwards, they always
wish they were younger.
Please reply to list if it's a mailing list post - http://shlom.in/reply .
Re: singleton for script with shebang, Ole Tange, 2015/01/02