Re: [iPAQ] run-once ?

From: Tom <tom_at_lemuria.org>
Date: Mon, 31 Dec 2001 11:56:46 +0100

On Mon, Dec 31, 2001 at 12:26:16AM +0000, Alan Cox wrote:
> Something as simple as doing
>
> open lockfile
> flock lockfile
> exec binary
>
> will work. The binary will close the lock file when it exits,breaking the
> lock. flock allows you to test a lock so you can avoid blocking taking it

that part is easy. I would, however, prefer to look into /proc or ps
instead, just to make sure that a) I catch cases where the binary is
started by other means, too and b) to avoid all sorts of trouble with
lockfiles not being removed correctly (kill -9).

the more interesting part is dealing with the "it already runs" case.
cycling it to the foreground would probably be the best answer. that is
windowmanager territory, something I haven't coded in so far.

-- 
http://web.lemuria.org/pubkey.html
pub  1024D/D88D35A6 2001-11-14 Tom Vogt <tom_at_lemuria.org>
     Key fingerprint = 276B B7BB E4D8 FCCE DB8F  F965 310B 811A D88D 35A6
Received on Mon Dec 31 2001 - 02:57:39 EST

This archive was generated by hypermail 2.2.0 : Mon Jul 25 2005 - 17:18:58 EDT