Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

exim_lock(8) [suse man page]

EXIM_LOCK(8)						      System Manager's Manual						      EXIM_LOCK(8)

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. For a discussion of locking issues, see section 25.2. exim_lock can be used to prevent any modification of a mailbox by Exim or a user agent while investigating a problem. The utility requires the name of the file as its first argument. 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 this is unset or empty, /bin/sh is run. When the command finishes, the mailbox is unlocked and the utility ends. The following options are available: -fcntl Use "fcntl()" locking on the open mailbox. -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). -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. If none of -fcntl, -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. The use of -fcntl 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. The -mbx option is mutually exclusive with -fcntl. It 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. 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. 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. 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. 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). March 26, 2003 EXIM_LOCK(8)

Check Out this Related Man Page

LOCKMAIL(1)						      Double Precision, Inc.						       LOCKMAIL(1)

NAME
lockmail - create mail lock files SYNOPSIS
lockmail [-r] [-t timeout] {lockfile} {program} [argument...] DESCRIPTION
lockmail is a helper utility for working with mailbox files. Mailbox files must be locked to prevent other applications from modifying the mailbox at the same time. Different system use different locking conventions. lockmail uses two of the most common locking mechanisms in use, which should work reliably on most systems. lockfile is the pathname to an existing mailbox file. By default, lockmail tries to lock the mailbox every five seconds (if the mailbox is already locked), and will give up after three minutes. After the mailbox is successfully locked, lockmail runs program as a child process, with any optional arguments. When program terminates, lockmail removes the mailbox lock, and terminates itself. OPTIONS
-r If a regular lock fails, try a read-only lock. Use this option to lock mailbox files in a read-only directory. -t timeout If the lock attempt fails, try again for up to timeout seconds. The actual timeout is rounded up to the next five second interval (a lock attempt is tried every five seconds). DESCRIPTION
This section briefly describes the locking mechanism used by lockmail. lockmail uses three different locking conventions in order to maximize compatibility with other mail software: C-Client folder locks, dot-locks, and file locks. C-Client folder locks Mail software based on the C-Client library creates lock files named /tmp/.dddddd.iiiiii. Here, dddddd and iiiiii are the device number and the inode number of the mailbox file (the st_dev and st_ino fields in the inode), in hexadecimal. If the process ID saved in the C-Client folder lock file is not valid, lockmail concludes that it's a stale lock file, and will remove it. Note A race condition exists where a C-Client process is killed after it creates a lock file, but before saving its process ID in the lock file. The race window is very small, but it exists. The C-Client library does not appear to ever clear out the lock file. lockmail attempts to resolve this race condition by deleting zero-length lock files that are at least five minutes old. dot-locks lockmail also creates, and honors dot-lock files. Dot-lock files are first created as temporary files, then linked to lockfile.lock. The link operation fails if the dot-lock file already exists. lockmail uses an enhanced method of dot-locking, where its process ID, and the name of the server where lockmail is running is also saved in its dot-lock file. If the operation fails due to an existing dot-lock file that was created by another lockmail process on the same server, and the process ID no longer exists, this stale dot-lock file is removed immediately. In all other situations a dot-lock file older than five minutes is considered stale, and removed. Note A failure to create a dot-lock file is silently ignored if the reason for the failure is because lockmail does not have the write permission in the dot-lock file's directory. The incoming mail spool directory (usually /var/mail) typically does not have global write permissions, so the attempt to create the dot-lock file in the spool directory will fail, and lockmail will be content with using file-locking only. File locks The final locking mechanism lockmail uses is the operating system's file locking facility. If lockmail fails to obtain all three locks, lockmail will sleep for five seconds and try again. The only exception is a failure to create a dot-lock because of no write access to the dot-lock file's directory, which is ignored. If lockmail still fails to obtain all required locks in the amount of time specified by the -t option (or its default value), lockmail will terminate with the EX_TEMPFAIL exit code. lockmail runs program after obtaining the last file lock, waits until program terminates, and releases all locks. program must terminate before any of the locks obtained by lockmail expire, and are considered stale. lockmail will then terminate with the same exit code as program. EXIT STATUS
lockmail terminates with the same exit status as program lockmail terminates with the EX_TEMPFAIL exit status if it was unable to obtain a lock, or if program was killed by a signal. SEE ALSO
maildrop(1)[1], sendmail(8). AUTHOR
Sam Varshavchik Author NOTES
1. maildrop(1) [set $man.base.url.for.relative.links]/maildrop.html Courier Mail Server 08/30/2011 LOCKMAIL(1)
Man Page