PMLOCK(1)

πŸ“¦
version 7.2.2 Β· 2 versions
, in arch rolling, centos-stream 10, fedora 43, fedora 44, ubuntu resolute, ubuntu stonking

πŸ’– PMLOCK(1) πŸ’–

bestie!! welcome to section 1 of the General Commands Manual, aka the part of the manual where we talk about pmlock. it's a whole command, it lives at $PCP_BINADM_DIR/pmlock, and it's here to be your tiny little lock girlie. let's get into it ✨


🌸 NAME 🌸

pmlock β€” simple file-based mutex. that's it, that's the whole vibe. it locks stuff by existing. iconic behavior honestly πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

$PCP_BINADM_DIR/pmlock [-i ident] [-v] file

✨ DESCRIPTION ✨

okay so here's the tea. pmlock tries to acquire an exclusive lock, and the way it does that is by creating a zero-sized file with a mode of 0. no content, no permissions, just vibes and exclusivity. very demure, very mindful πŸ’…

then there's the -i option, which is where things get a little different. when you use it, the behavior switches up: instead of an empty file, it writes ident into file, followed by a newline, and the file mode becomes 0444. so now your lock file has receipts 🫢

ident is an arbitrary string, so like, technically you can put whatever you want in there. but by convention it's the process id of the locker, followed by the name or identification of the locker command or script. do that. be a good citizen 🧚

the exit status is 0 for success and 1 for failure. no in-between, no "it depends", just those two. periodt.

when you're done and you wanna let the lock go? to release the lock, remove file with rm(1) or unlink(2). bye bye lock file, you served your purpose πŸ’œ

and listen β€” in the event of a failure, the -v option produces an explanatory message on stderr. so if something goes sideways, -v will actually tell you what's up instead of leaving you on read. use it, bestie 😭


πŸŽ€ OPTIONS πŸŽ€

  • -i ident β€” changes the behavior so it writes ident into file followed by a newline, and the file mode is 0444. ident is an arbitrary string, but by convention it's the process id of the locker followed by the name or identification of the locker command or script. 🌈
  • -v β€” in the event of a failure, produces an explanatory message on stderr. lowkey essential when things go wrong πŸ‘‘

πŸ‘‘ SEE ALSO πŸ‘‘

rm(1) and unlink(2). that's the whole squad 🫢


and that's the page!! this one came to you from Performance Co-Pilot (PCP) β€” the source/version tag is right there on the tin, and the manual name is PMLOCK(1) in case you forgot which page you were on. mwah, go lock something responsibly πŸ’–βœ¨

πŸ“¦ where this page comes from