dotlock

Name

dotlock -- create mail lock files

Synopsis

dotlock [-f] {lockfile} {program} [arg...]

DESCRIPTION

The dotlock program creates a lock file that's compatible with maildrop, and other mail software, then runs program. The lock file is removed when program terminates.

Because a mailbox file can only be accessed by one program at a time, a lock file must be used by all programs who need to use the mailbox file. Otherwise, while one program uses a mailbox file, another program can write to it, resulting a corrupted mailbox. dotlock creates a dot-lock file by default. The -f option create an flock lock instead (the file is opened, and the flock() system call creates a lock on the file).

Note

You must specify the full name of the lock file, including any ".lock" extension. Therefore, use /var/spool/mail/user.lock to lock /var/spool/mail/user. If you omit the .lock extension, you'll end up deleting your mail!

SEE ALSO

maildrop(1), sendmail(8).