• Only one door per node

    From Gods69@21:3/220 to All on Thu Nov 5 10:19:19 2026
    Hi,
    I'm looking for a way to execute only one Door32 instance at the time, only one node can run it. I see the method on the Wiki using semaphore but if the
    door crash the semaphore will never be cleared and the Door will never be reachable again.
    Thanks.

    ... If you eat yogurt you'll have lots of culture.

    --- Mystic BBS v1.12 A48 (Linux/64)
    * Origin: Gods69 BBS (21:3/220)
  • From Goose@21:1/177 to Gods69 on Thu Nov 5 12:23:26 2026
    Hi Gods69,

    Yeah, the wiki semaphore trick has exactly that problem: if the door
    crashes, the file sticks around and the door is dead until someone
    deletes it by hand.

    On Linux there's a cleaner way: wrap the door with flock. The kernel
    releases the lock as soon as the process dies, crash or not. No stale
    lock left behind.

    Example for a D3 menu command:

    /usr/bin/flock -n /mystic/locks/mygame.lock /path/to/yourdoor %P

    Create /mystic/locks/ once. The lock file itself can stay on disk; what
    matters is the active hold. With -n, flock fails immediately if another
    node already holds it, so the door never starts twice. You can then show
    a short "busy, try later" message (e.g. with a menu ACS / !E check, or
    by checking flock's exit code in a tiny wrapper).

    Tiny wrapper if you want the busy message:

    #!/bin/sh
    LOCK=/mystic/locks/mygame.lock
    DOOR=/path/to/yourdoor
    if ! flock -n "$LOCK" "$DOOR" "$@"; then
    echo "Sorry, that door is already in use. Try again later."
    sleep 2
    fi

    Point D3 at the wrapper instead of the door binary. Same idea works for
    DD doors too.

    If you want to stay with the wiki semaphore method, a wrapper that
    checks whether the door process is still alive and deletes a stale
    semaphore first also works. flock is just more robust.

    Cheers
    Goose

    --- Mystic BBS v1.12 A48 (Linux/64)
    * Origin: Goosenet BBS (21:1/177)
  • From Gods69@21:3/220 to Goose on Sun Nov 8 07:53:07 2026
    On Linux there's a cleaner way: wrap the door with flock. The kernel releases the lock as soon as the process dies, crash or not. No stale
    lock left behind.

    Thanks. I will try it...

    ... Communism is like one big phone company. (Lenny Bruce)

    --- Mystic BBS v1.12 A48 (Linux/64)
    * Origin: Gods69 BBS (21:3/220)