The simplest way I can think of to solve this is:

(start)
        mkdir /tmp/adduser.lock
        sleep and loop until mkdir succeeds

(end)
        remove /tmp/adduser.lock

which should be atomic assuming a local /tmp.

One could possibly add a /tmp/adduser.lock/adduser.pid and check for a
dead lock.. I hesitate to overcomplicate this one (and certainly don't
want a dependency for it).

Thoughts?

Reply via email to