LCKDO(1)

πŸ“¦
version 0.70 Β· 3 versions
  • 0.70 Β· debian bookworm, debian trixie, epel 10, epel 9, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.70 Β· alpine 3.24
  • 0.70 Β· arch rolling
, in debian bookworm, debian trixie, epel 10, epel 9, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ LCKDO ✨

okay bestie, gather round, because lckdo is one of those lil moreutils gems that's giving quietly iconic πŸ’…


🌸 NAME 🌸

lckdo β€” run a program with a lock held πŸ”’


πŸ¦‹ SYNOPSIS πŸ¦‹

lckdo [options] {lockfile} {program} [arguments]

πŸ’– DESCRIPTION πŸ’–

So basically lckdo runs a program with a lock held, and the whole point is to stop multiple processes from running in parallel β€” like, no cap, it's a bouncer at the club door of your process table πŸŽ€. Use it just like nice or nohup, fr fr.

okay so here's the sad part 😭 β€” now that util-linux contains a similar command named flock, lckdo is deprecated, and it will be removed from some future version of moreutils. it's giving retirement era, and we're not okay about it πŸ’€

πŸ‘‘ OPTIONS πŸ‘‘

  • -w β€” if the lock is already held by another process, just wait for it to complete instead of failing immediately. patience is a virtue bestie 🫢
  • -W {sec} β€” the same as -w, but wait not more than sec seconds. so like, waiting with a timer ⏰
  • -e β€” execute the program directly without forking and waiting (keeps an extra file descriptor open). lowkey efficient ✨
  • -E {nnn} β€” set the file descriptor number to keep open when exec()ing (implies -e). you pick the number, she keeps the door open πŸšͺ
  • -n β€” do not create the lock file if it does not exist. no lock file? no problem, she's not making one πŸ™ˆ
  • -q β€” produce no output if the lock is already held. silent treatment, but make it intentional πŸ’…
  • -s β€” lock in shared (read) mode. we're all reading together, cozy 🌸
  • -x β€” lock in exclusive (write) mode (default). one at a time, main character energy πŸ‘‘
  • -t β€” test for lock existence. just checking, no commitment 🧚

🌈 EXIT STATUS 🌈

If the lock was successfully acquired, the return value is that of the program invoked by lckdo β€” so whatever your program says goes, she's just the messenger πŸ’Œ.

If the lock couldn't be acquired, EX_TEMPFAIL is returned. 😭

If there was a problem opening/creating or locking the lock file, EX_CANTCREAT or EX_OSERR will be returned. πŸ’€


⭐ AUTHOR ⭐

Michael Tokarev β€” we love a legend 🫢


and that's the whole page bestie!! this one's from moreutils, dated 2007-08-15 β€” yes she's an elder icon and yes she still slays πŸŽ€βœ¨ bye ily πŸ¦‹

πŸ“¦ where this page comes from