version 1, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
DOTLOCKFILE |
|
|
2 |
!!!DOTLOCKFILE |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
OPTIONS |
|
|
7 |
RETURN VALUE |
|
|
8 |
NOTES |
|
|
9 |
BUGS |
|
|
10 |
SEE ALSO |
|
|
11 |
AUTHOR |
|
|
12 |
---- |
|
|
13 |
!!NAME |
|
|
14 |
|
|
|
15 |
|
|
|
16 |
dotlockfile - Utility to manage lockfiles |
|
|
17 |
!!SYNOPSIS |
|
|
18 |
|
|
|
19 |
|
|
|
20 |
__/usr/bin/dotlockfile__ [[__-p__] [[__-c__] |
|
|
21 |
[[__-u__] [[__-m__] [[__-l|-u__] [[__-r__ |
|
|
22 |
''retries''] [[__lockfile]__ |
|
|
23 |
!!DESCRIPTION |
|
|
24 |
|
|
|
25 |
|
|
|
26 |
__Dotlockfile__ is a command line utility to safely |
|
|
27 |
create, test and remove lockfiles. Lockfiles are created in |
|
|
28 |
an NFS-safe way. __Dotlockfile__ can lock and unlock |
|
|
29 |
mailboxes even if the mailspool directory is only writable |
|
|
30 |
by group mail. |
|
|
31 |
|
|
|
32 |
|
|
|
33 |
The name __dotlockfile__ comes from the way mailboxes are |
|
|
34 |
locked for updates on a lot of UNIX systems. A lockfile is |
|
|
35 |
created with the same filename as the mailbox but with the |
|
|
36 |
string __.lock'''' |
|
|
37 |
|
|
|
38 |
|
|
|
39 |
The names __dotlock__ and __lockfile__ were already |
|
|
40 |
taken - hence the name __dotlockfile__ |
|
|
41 |
'':)''. |
|
|
42 |
!!OPTIONS |
|
|
43 |
|
|
|
44 |
|
|
|
45 |
__-l__ |
|
|
46 |
|
|
|
47 |
|
|
|
48 |
Create a lockfile. This is the default. |
|
|
49 |
|
|
|
50 |
|
|
|
51 |
__-u__ |
|
|
52 |
|
|
|
53 |
|
|
|
54 |
Remove a lockfile. |
|
|
55 |
|
|
|
56 |
|
|
|
57 |
__-c__ |
|
|
58 |
|
|
|
59 |
|
|
|
60 |
Check for the existence of a __valid__ |
|
|
61 |
lockfile. |
|
|
62 |
|
|
|
63 |
|
|
|
64 |
__-p__ |
|
|
65 |
|
|
|
66 |
|
|
|
67 |
Write the ''process-id'' of the calling process into the |
|
|
68 |
lockfile. Also when testing for an existing lockfile, check |
|
|
69 |
the contents for a process-id to find out if the lockfile is |
|
|
70 |
still valid. |
|
|
71 |
|
|
|
72 |
|
|
|
73 |
__-r retries__ |
|
|
74 |
|
|
|
75 |
|
|
|
76 |
The number of times __dotlockfile__ tries to acquire the |
|
|
77 |
lock before giving up. The initial sleep after failing to |
|
|
78 |
acquire the lock is 5 seconds. After each next try, a sleep |
|
|
79 |
of 5 seconds ''extra'' occurs up to a maximum sleep of 60 |
|
|
80 |
seconds between tries. |
|
|
81 |
|
|
|
82 |
|
|
|
83 |
__-m__ |
|
|
84 |
|
|
|
85 |
|
|
|
86 |
Lock or unlock the current users mailbox. The path to the |
|
|
87 |
mailbox is the default system mailspool directory (usually |
|
|
88 |
''/var/mail'') with the username as gotten from |
|
|
89 |
''getpwuid()'' appended. If the environment variable |
|
|
90 |
''$MAIL'' is set, that is used instead. Then the string |
|
|
91 |
'''' is appended to get the name of the |
|
|
92 |
actual lockfile. |
|
|
93 |
|
|
|
94 |
|
|
|
95 |
lockfile |
|
|
96 |
|
|
|
97 |
|
|
|
98 |
The lockfile to be created/removed, unless the __-m__ |
|
|
99 |
option is in effect. |
|
|
100 |
!!RETURN VALUE |
|
|
101 |
|
|
|
102 |
|
|
|
103 |
Zero on success, and non-zero on failure. For the __-c__ |
|
|
104 |
option, sucess means that a valid lockfile is already |
|
|
105 |
present. When locking (the default, or the __-l__ option) |
|
|
106 |
__dotlockfile__ returns the same values as the library |
|
|
107 |
function ''lockfile_create''(3). |
|
|
108 |
!!NOTES |
|
|
109 |
|
|
|
110 |
|
|
|
111 |
The lockfile is created exactly as named on the command |
|
|
112 |
line. The extension ''.lock'' is ''not'' automatically |
|
|
113 |
added. |
|
|
114 |
|
|
|
115 |
|
|
|
116 |
This utility is a lot like the lockfile(1) utility |
|
|
117 |
included with ''procmail'', and the |
|
|
118 |
''mutt_dotlock''(1) utility included with ''mutt''. |
|
|
119 |
However the command-line arguments differ, and so does the |
|
|
120 |
return status. It is believed that ''dotlockfile'' is the |
|
|
121 |
most flexible implementation, since it automatically detects |
|
|
122 |
when it needs to use priviliges to lock a mailbox, and does |
|
|
123 |
it safely. |
|
|
124 |
!!BUGS |
|
|
125 |
|
|
|
126 |
|
|
|
127 |
None known. |
|
|
128 |
!!SEE ALSO |
|
|
129 |
|
|
|
130 |
|
|
|
131 |
lockfile_create(3), maillock(3) |
|
|
132 |
!!AUTHOR |
|
|
133 |
|
|
|
134 |
|
|
|
135 |
Miquel van Smoorenburg, miquels@cistron.nl |
|
|
136 |
---- |