setlock(8)
π setlock(8) β the "run ur lil program but WITH a lock on it" manual π
okay so bestie, this is a page from the System Manager's Manual, and it's all about setlock, which runs another program with a file locked. iconic behaviour honestly. let's get into it πΈ
β¨ NAME β¨
setlock β runs another program with a file locked.
that's it. that's the whole vibe. it locks a file and runs ur child process. slay π
β¨ SYNOPSIS β¨
setlock [ -nNxX ] fn child
β¨ DESCRIPTION β¨
okay so here's the tea π«
fn is a single argument. child consists of one or more arguments.
setlock opens fn for writing (creating it if it does not exist, no cap), obtains an exclusive lock on it, and runs child. that's the whole thing, she's simple, she's effective π
Normally the lock disappears when child exits. bye lock π
Here's the complete story, fr fr: child is given a descriptor for a locked ofile pointing to the disk file named fn. The lock disappears when this ofile is
- closed by all the processes that have descriptors for it or
- explicitly unlocked.
so likeβ¦ it's not just "when the process dies", it's about the descriptor. iykyk π
β¨ OPTIONS β¨
-nβ No delay. Iffnis locked by another process,setlockgives up. she's not waiting around for anybody, main character energy only π-Nβ (Default.) Delay. Iffnis locked by another process,setlockwaits until it can obtain a new lock. patient queen π§-xβ Iffncannot be opened (or created) or locked,setlockexits zero. yes really, zero. wild but true π-Xβ (Default.) Iffncannot be opened (or created) or locked,setlockprints an error message and exits nonzero. the drama of it all π
lowkey important:-Nand-Xare the defaults, so if u just run it plain, u get the waiting + the error message combo. periodt.
β¨ SEE ALSO β¨
go read these too bestie, they're all part of the same friend group π
supervise(8), svc(8), svok(8), svstat(8), svscanboot(8), svscan(8), readproctitle(8), fghack(8), pgrphack(8), multilog(8), tai64n(8), tai64nlocal(8), setuidgid(8), envuidgid(8), envdir(8), softlimit(8)
http://cr.yp.to/daemontools.html
and that's the whole page, bestie π¦ this lil cutie lives in the System Manager's Manual under the name setlock(8) β same name up top, same name at the bottom, symmetric queen π k bye, go lock something responsibly β¨
π¦ where this page comes from
- debian bookworm: daemontools 1:0.76-8.1 Β· LicenseRef-public-domain
- debian trixie: daemontools 1:0.76-14 Β· LicenseRef-public-domain
- nixpkgs unstable: daemontools 0.76
- ubuntu jammy: daemontools 1:0.76-7
- ubuntu noble: daemontools 1:0.76-10 Β· LicenseRef-public-domain
- ubuntu questing: daemontools 1:0.76-15
- ubuntu resolute: daemontools 1:0.76-15build1 Β· LicenseRef-public-domain
- ubuntu stonking: daemontools 1:0.76-15build1 Β· LicenseRef-public-domain
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms