blob: 6243dc2a35723e38535b95734336a9bd55820fcc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
'\" t
.\" Title: lckdo
.\" Author: Michael Tokarev
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 2007-08-15
.\" Manual: moreutils
.\" Source: moreutils
.\" Language: English
.\"
.TH "LCKDO" "1" "2007\-08\-15" "moreutils" "moreutils"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
lckdo \- run a program with a lock held
.SH "SYNOPSIS"
.HP \w'\fBlckdo\fR\ 'u
\fBlckdo\fR [options] {lockfile} {program} [arguments]
.SH "DESCRIPTION"
.PP
\fBlckdo\fR
runs a program with a lock held, in order to prevent multiple processes from running in parallel\&. Use just like
\fBnice\fR
or
\fBnohup\fR\&.
.PP
Now that util\-linux contains a similar command named
\fBflock\fR, lckdo is deprecated, and will be removed from some future version of moreutils\&.
.SH "OPTIONS"
.PP
\fB\-w\fR
.RS 4
If the lock is already held by another process, wait for it to complete instead of failing immediately\&.
.RE
.PP
\fB\-W {sec}\fR
.RS 4
The same as \-w but wait not more than sec seconds\&.
.RE
.PP
\fB\-e\fR
.RS 4
Execute the program directly without forking and waiting (keeps an extra file descriptor open)\&.
.RE
.PP
\fB\-E {nnn}\fR
.RS 4
Set the file descriptor number to keep open when exec()ing (implies \-e)\&.
.RE
.PP
\fB\-n\fR
.RS 4
Do not create the lock file if it does not exist\&.
.RE
.PP
\fB\-q\fR
.RS 4
Produce no output if lock is already held\&.
.RE
.PP
\fB\-s\fR
.RS 4
Lock in shared (read) mode\&.
.RE
.PP
\fB\-x\fR
.RS 4
Lock in exclusive (write) mode (default)\&.
.RE
.PP
\fB\-t\fR
.RS 4
Test for lock existence\&.
.RE
.SH "EXIT STATUS"
.PP
If the lock was successfully acquired, the return value is that of the program invoked by
\fBlckdo\fR\&. If the lock couldn\*(Aqt be acquired, EX_TEMPFAIL is returned\&. If there was a problem opening/creating or locking the lock file, EX_CANTCREAT or EX_OSERR will be returned\&.
.SH "AUTHOR"
.PP
Michael Tokarev
|