EXIM_LOCK(8)

πŸ’– EXIM_LOCK(8) β€” bestie edition πŸ’–

okay so this is the manual for exim_lock, living in the System Manager's Manual section (that's section 8, iykyk). Grab a snack, we're locking mailboxes πŸŽ€


✨ NAME ✨

exim_lock β€” Mailbox maintenance πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

exim_lock [options]mailbox-file

🌸 DESCRIPTION 🌸

The exim_lock utility locks a mailbox file using the same algorithm as Exim. If you wanna go deep on locking drama, go read the section "appendfile transport", subsection "Operational details for appending" in the Exim specification β€” that's where all the lore lives πŸ“–

So like, why would you even want this? Bestie, exim_lock can be used to prevent any modification of a mailbox by Exim or a user agent while you're off investigating a problem. Forensic queen behavior πŸ”βœ¨

The utility requires the name of the file as its first argument. Then:

  • If the locking is successful, the second argument is run as a command (using C's β€œsystem()” function) πŸ’«
  • If there is no second argument, the value of the SHELL environment variable is used 🐚
  • If that's unset or empty, /bin/sh is run 🐌

When the command finishes, the mailbox is unlocked and the utility ends. Clean exit, no mess, periodt 🌈

The following options are available:


πŸ’œ OPTIONS πŸ’œ

  • -fcntl β€” Use β€œfcntl()” locking on the open mailbox πŸ”’
  • -flock β€” Use β€œflock()” locking on the open mailbox, provided the operating system supports it (check before you vibe, some OSes said no πŸ™ˆ)
  • -interval β€” This must be followed by a number, which is a number of seconds; it sets the interval to sleep between retries (default 3) ⏰
  • -lockfile β€” Create a lock file before opening the mailbox πŸ“„
  • -mbx β€” Lock the mailbox using MBX rules πŸ“¬
  • -q β€” Suppress verification output 🀫
  • -retries β€” This must be followed by a number; it sets the number of times to try to get the lock (default 10) πŸ”
  • -restore_time β€” This option causes exim_lock to restore the modified and read times to the locked file before exiting. This allows you to access a locked mailbox (for example, to take a backup copy) without disturbing the times that the user subsequently sees πŸ•°οΈβœ¨ (honestly iconic)
  • -timeout β€” This must be followed by a number, which is a number of seconds; it sets a timeout to be used with a blocking β€œfcntl()” lock. If it is not set (the default), a non-blocking call is used ⏳
  • -v β€” Generate verbose output πŸ—£οΈ

πŸŽ€ the default behavior (important bestie) πŸŽ€

If none of -fcntl, -flock, -lockfile or -mbx are given, the default is to create a lock file and also use β€œfcntl()” locking on the mailbox, which is the same as Exim's default. That's the OTP right there πŸ’ž

Permission tea β˜•:

  • The use of -fcntl or -flock requires that the file be writable ✍️
  • The use of -lockfile requires that the directory containing the file be writable πŸ“
Locking by lock file does not last for ever; Exim assumes that a lock file is expired if it is more than 30 minutes old. So no, that lock file from three hours ago is not still valid, bestie πŸ’€

The -mbx can be used with either or both of -fcntl or -flock. It assumes -fcntl by default. MBX locking causes a shared lock to be taken out on the open mailbox, and an exclusive lock on the file /tmp/.n.m where n and m are the device number and inode number of the mailbox file. When the locking is released, if an exclusive lock can be obtained for the mailbox, the file in /tmp is deleted 🧹✨

πŸ“’ about the output πŸ“’

The default output contains verification of the locking that takes place. The -v option causes some additional information to be given. The -q option suppresses all output except error messages 🀐


🫢 examples, because we love a demo 🫢

A command such as

exim_lock /var/spool/mail/spqr

runs an interactive shell while the file is locked 😌 whereas

exim_lock -q /var/spool/mail/spqr <<End
<some commands>
End

runs a specific non-interactive sequence of commands while the file is locked, suppressing all verification output 🀫 A single command can be run by a command such as

exim_lock -q /var/spool/mail/spqr     "cp /var/spool/mail/spqr
/some/where"
Note that if a command is supplied, it must be entirely contained within the second argument β€” hence the quotes. Don't forget the quotes, bestie, or it's giving chaos 😭

πŸ’€ BUGS πŸ’€

This manual page needs a major re-work. If somebody knows better groff than us and has more experience in writing manual pages, any patches would be greatly appreciated. (ngl this is the most honest section in any manpage ever, we respect the vulnerability πŸ₯Ή)


πŸ” SEE ALSO πŸ”

  • exim(8)
  • /usr/share/doc/exim4-base/

πŸ‘‘ AUTHOR πŸ‘‘

This manual page was stitched together from spec.txt by Andreas Metzler <ametzler at downhill.at.eu.org>, for the Debian GNU/Linux system (but may be used by others). Slay, Andreas πŸ«‘πŸ’–


and that's the whole page, bestie!! 🌈 This beauty comes from the Exim documentation set, and the page itself is dated May 12, 2020 β€” so go forth, lock those mailboxes responsibly, restore those timestamps, and stay iconic βœ¨πŸŽ€πŸ’