Bug#741300: lockfile-progs: Please add run-with-lockfile implementation

2016-12-15 Thread Rob Browning
Petter Reinholdtsen  writes:

> Hi.  I have not had time to rewrite a tool usable with cron jobs, but
> just wanted to you to know the need is still there.  Today I made
> another copy of run-with-lockfile into a server where I need to run a
> cron job regularly with locking.
>
> Is there really no better way to do this in Debian?

I don't know offhand, and while I understand your situation, my earlier
assessment of the code for run-with-lockfile is that it's just not
(currently) something I want to assume responsibility for.

-- 
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4



Bug#741300: lockfile-progs: Please add run-with-lockfile implementation

2016-12-13 Thread Petter Reinholdtsen

Hi.  I have not had time to rewrite a tool usable with cron jobs, but
just wanted to you to know the need is still there.  Today I made
another copy of run-with-lockfile into a server where I need to run a
cron job regularly with locking.

Is there really no better way to do this in Debian?

-- 
Happy hacking
Petter Reinholdtsen



Bug#741300: lockfile-progs: Please add run-with-lockfile implementation

2016-08-15 Thread Petter Reinholdtsen
[Rob Browning]
> Ahh, right.  Though as I think you mentioned the C version doesn't use
> liblockfile, which we'd want, and as the code mentions, it probably
> needs fork/exec, and I'd want signal handling, etc.

Right.  The C version is only 128 lines of C code, and the complete code
is available from http://bugs.debian.org/660216 >.  It is not
using liblockfile.

> So I don't know if/when I might hack on this any further, but if I do,
> it may a bit.

Right.  The run-with-lockfile feature is used by cron jobs in a several
mySociety projects like fixmystreet.com and whatdotheyknow.com, and I
would really love to get all their dependencies into Debian to make my
life easier when upgrading the Norwegian versions of these services to
newer Debian versions in the future.

What more could be done to get a simple 'run-with-lockfile'
implementation available in Debian by default.  Its main task is to make
sure a cron job do not run several instances.  The C version was very
nice, as it could use the cron job script as its own lock file, which
the shell version can not.

-- 
Happy hacking
Petter Reinholdtsen



Bug#741300: lockfile-progs: Please add run-with-lockfile implementation

2016-06-17 Thread Rob Browning
Petter Reinholdtsen  writes:

> Note, this shell script is a replacement for the original C version.  I
> suggested its inclusion in  but
> later concluded that it was better to try to get the function into an
> existing package instead of creating a deb with only one binary for such
> small task.  And then the shell wrapper came around because it removed
> the need to compile something to get cron jobs working.

Ahh, right.  Though as I think you mentioned the C version doesn't use
liblockfile, which we'd want, and as the code mentions, it probably
needs fork/exec, and I'd want signal handling, etc.

So I don't know if/when I might hack on this any further, but if I do,
it may a bit.


I'd also thought about suggesting that the existing shell script might
want to run the subcommand via something like

  "$@"

instead of

  sh -c "$COMMAND"

but then realized that maybe the intention was for the (single) command
string to be parsed by sh. i.e.

  run-with-lockfile somelock "apache -d \"some dir\" -f \"some file.conf\""

and not anything like

  run-with-lockfile somelock apache -d "some dir" -f "some file.conf"

Thanks
-- 
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4



Bug#741300: lockfile-progs: Please add run-with-lockfile implementation

2016-06-17 Thread Petter Reinholdtsen
[Rob Browning]
>   - After a bit of effort I realized that solidly handling the bits I
> was interested in might actually be easier in C, which would also
> fit better with the rest of lockfile-progs.  So I spent some time,
> off and on over a few days, working on a C version.

Note, this shell script is a replacement for the original C version.  I
suggested its inclusion in  but
later concluded that it was better to try to get the function into an
existing package instead of creating a deb with only one binary for such
small task.  And then the shell wrapper came around because it removed
the need to compile something to get cron jobs working.

--
Happy hacking
Petter Reinholdtsen



Bug#741300: lockfile-progs: Please add run-with-lockfile implementation

2016-06-16 Thread Rob Browning
Petter Reinholdtsen  writes:

> Hi.  Today I needed a way to run a cron job with a lock file, and really 
> missed
> this script in a Debian package.  Please have a look and see if you can 
> include
> it in the lockfile-progs package.

Thanks for the ping, and I took some time to work on this:

  - I noticed the script has a different license from the rest of
lockfile-progs, but while I'd prefer to have a single license, that
might not be critical, and I could of course talk to the authors.

  - While looking at the script, I noticed changes that I'd want to make
before incorporating it -- with respect to error handling, signals,
string escaping, etc.

  - After a bit of effort I realized that solidly handling the bits I
was interested in might actually be easier in C, which would also
fit better with the rest of lockfile-progs.  So I spent some time,
off and on over a few days, working on a C version.

  - During that process, I realized both that there are enough corner
cases that it would take some time to get everything right, and that
I also don't really know exactly how I think a general purpose
wrapper like this should behave (something that would definitely
need to be sorted out first).  As just one example, I'm not sure how
it could know (without being told) whether or not it should remove
the lockfile if the child process fails -- and perhaps the answer
depends in some cases on just how it fails).

So in the end, I suspect that creating a wrapper like this that I'd want
to maintain over the long run is likely to be more work than I should
undertake at the moment.

In any case, sorry I can't help more directly right now, but I'll keep
this in mind; it's possible I might poke at it again later.

Thanks
-- 
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4



Bug#741300: lockfile-progs: Please add run-with-lockfile implementation

2016-06-03 Thread Petter Reinholdtsen
[Rob Browning 2014-04-25]
>> Hi.  Did you find time to look at my proposal to add a lock file wrapper
>> run-with-lockfile in the lockfile-progs package?  I had to set up a cron
>> job with locking today, and was reminded how painful it is without such
>> wrapper available. :)
> 
> I haven't, but I'll try to take a look in the next week or so.
> 
> If I don't, feel free to ping me.

Hi.  Today I needed a way to run a cron job with a lock file, and really missed
this script in a Debian package.  Please have a look and see if you can include
it in the lockfile-progs package.
-- 
Happy hacking
Petter Reinholdtsen



Bug#741300: lockfile-progs: Please add run-with-lockfile implementation

2014-04-25 Thread Petter Reinholdtsen

Hi.  Did you find time to look at my proposal to add a lock file wrapper
run-with-lockfile in the lockfile-progs package?  I had to set up a cron
job with locking today, and was reminded how painful it is without such
wrapper available. :)

-- 
Happy hacking
Petter Reinholdtsen


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#741300: lockfile-progs: Please add run-with-lockfile implementation

2014-04-25 Thread Rob Browning
Petter Reinholdtsen p...@hungry.com writes:

 Hi.  Did you find time to look at my proposal to add a lock file wrapper
 run-with-lockfile in the lockfile-progs package?  I had to set up a cron
 job with locking today, and was reminded how painful it is without such
 wrapper available. :)

I haven't, but I'll try to take a look in the next week or so.

If I don't, feel free to ping me.
-- 
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#741300: lockfile-progs: Please add run-with-lockfile implementation

2014-03-10 Thread Petter Reinholdtsen

Package: lockfile-progs
Version: 0.1.17
Tags: patch
Severity: wishlist

During my work with Fixmystreet and Alaveteli from mysociety, I have
discovered the usefulness of their run-with-lockfile utility.  It is
very useful in cron jobs, to ensure only one cron job run at the time.
The cron job would look like something like this:

  run-with-lockfile -n /some/lock /some/command args  /some/log || echo 
stalled?

The original implementation is in C, and I planned to upload it to
Debian (See WNPP request URL: http://bugs.debian.org/660216 ).  But
then I discovered a shell version using the tools in lockfile-progs
available from
URL: 
https://github.com/mysociety/commonlib/blob/master/bin/run-with-lockfile.sh .

Would you be willing to import that script into the lockfile-progs
package to make this very useful tool available directly in a Debian
package?

-- 
Happy hacking
Petter Reinholdtsen


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org