1DOTLOCKFILE(1)                 Cistron Utilities                DOTLOCKFILE(1)
2
3
4

NAME

6       dotlockfile - Utility to manage lockfiles
7

SYNOPSIS

9       /usr/bin/dotlockfile [-p] [-c] [-m] [-l|-u|-t] [-r retries] [lockfile]
10

DESCRIPTION

12       Dotlockfile is a command line utility to safely create, test and remove
13       lockfiles. Lockfiles are created in an NFS-safe  way.  Dotlockfile  can
14       can  also  be  used  to lock and unlock mailboxes even if the mailspool
15       directory is only writable by group mail.
16
17       The name dotlockfile comes  from  the  way  mailboxes  are  locked  for
18       updates  on  a lot of UNIX systems. A lockfile is created with the same
19       filename as the mailbox but with the string ".lock" appended.
20
21       The names dotlock and lockfile were already taken - hence the name dot‐
22       lockfile :).
23

OPTIONS

25       -l     Create a lockfile. This is the default.
26
27       -u     Remove a lockfile.
28
29       -c     Check for the existence of a valid lockfile.
30
31       -t     Touch an existing lockfile (update the timestamp).
32
33       -p     Write  the  process-id of the calling process into the lockfile.
34              Also when testing for an existing lockfile, check  the  contents
35              for a process-id to find out if the lockfile is still valid.
36
37       -r retries
38              The  number  of times dotlockfile retries to acquire the lock if
39              it failed the first time before giving  up.  The  initial  sleep
40              after  failing to acquire the lock is 5 seconds. After each next
41              try, a sleep of 5 seconds extra occurs up to a maximum sleep  of
42              60 seconds between tries.  The default number of retries is 5.
43
44       -m     Lock  or unlock the current users mailbox. The path to the mail‐
45              box  is  the  default  system   mailspool   directory   (usually
46              /var/mail) with the username as gotten from getpwuid() appended.
47              If the environment variable $MAIL is set, that is used  instead.
48              Then  the  string  ".lock"  is  appended  to get the name of the
49              actual lockfile.
50
51       lockfile
52              The lockfile to be created/removed, unless the -m option  is  in
53              effect.
54
55

RETURN VALUE

57       Zero  on  success,  and  non-zero on failure. For the -c option, sucess
58       means that a valid lockfile  is  already  present.  When  locking  (the
59       default,  or  the -l option) dotlockfile returns the same values as the
60       library function lockfile_create(3). Unlocking a non-existant  lockfile
61       is not an error.
62
63

NOTES

65       The  lockfile  is  created  exactly  as  named on the command line. The
66       extension .lock is not automatically added.
67
68       This utility is a lot like the lockfile(1) utility included with  proc‐
69       mail,  and  the mutt_dotlock(1) utility included with mutt. However the
70       command-line arguments differ, and so does the  return  status.  It  is
71       believed that dotlockfile is the most flexible implementation, since it
72       automatically detects when it needs to use priviliges to lock  a  mail‐
73       box, and does it safely.
74
75       The  above  mentioned  lockfile_create(3)  manpage  is  present  in the
76       liblockfile-dev package.
77
78

BUGS

80       None known.
81
82

SEE ALSO

84       lockfile_create(3), maillock(3)
85
86

AUTHOR

88       Miquel van Smoorenburg, miquels@cistron.nl
89
90
91
92                                  15 May 2003                   DOTLOCKFILE(1)
Impressum