]> git.lizzy.rs Git - plan9front.git/blob - sys/man/1/lock
dd(1): update manpage to match program
[plan9front.git] / sys / man / 1 / lock
1 .TH LOCK 1
2 .SH NAME
3 lock \- run a command under lock
4 .SH SYNOPSIS
5 .B lock
6 [
7 .B -w
8 ]
9 .I lockfile
10 [
11 .I command
12 [
13 .I argument
14 \&...
15 ] ]
16 .SH DESCRIPTION
17 .I Lock
18 runs
19 .I command
20 (default
21 .LR rc )
22 with
23 .I arguments
24 while holding
25 .I lockfile
26 open and (over)writing at least one byte each minute
27 to keep the exclusive-access lock alive.
28 If
29 .I lockfile
30 doesn't already have the exclusive-access bit set in
31 its mode,
32 the exclusive-access bits are set in its mode and
33 .BR qid.type .
34 .PP
35 Under
36 .BR -w ,
37 .I lock
38 waits for exclusive access to
39 .I lockfile
40 instead of just trying once.
41 .PP
42 .I Lock
43 sets
44 .B /env/prompt
45 to contain the name of the lock file.
46 .SH EXAMPLES
47 Build a
48 .IR replica (1)
49 database while preventing collisions with other occurrences.
50 .IP
51 .EX
52 cd /sys/lib/dist
53 lock scan.lock replica/scan $dist/sources.replica
54 .EE
55 .SH SOURCE
56 .B /sys/src/cmd/lock.c
57 .SH SEE ALSO
58 .IR intro (5),
59 .IR stat (5)
60 .\" .SH DIAGNOSTICS
61 .\" .SH BUGS