1 <?xml version=
"1.0" encoding=
"utf-8"?>
5 Written by Michael Tokarev <mjt@tls.msk.ru>
10 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook V4.4//EN"
11 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd"
17 <email>mjt@tls.msk.ru
</email>
20 <firstname>Michael
</firstname>
21 <surname>Tokarev
</surname>
23 <date>2007-
08-
15</date>
27 <refentrytitle>lckdo
</refentrytitle>
28 <manvolnum>1</manvolnum>
29 <refmiscinfo class=
"manual">moreutils
</refmiscinfo>
30 <refmiscinfo class=
"source">moreutils
</refmiscinfo>
34 <refname>lckdo
</refname>
35 <refpurpose>run a program with a lock held
</refpurpose>
40 <command>lckdo
</command>
42 <arg choice=
"req">lockfile
</arg>
43 <arg choice=
"req">program
</arg>
49 <title>DESCRIPTION
</title>
51 <para><command>lckdo
</command> runs a program with a lock
52 held, in order to prevent multiple processes from running in
53 parallel. Use just like
<command>nice
</command> or
54 <command>nohup
</command>.
</para>
56 <para>Now that util-linux contains a similar command
57 named
<command>flock
</command>, lckdo is deprecated,
58 and will be removed from some future version of moreutils.
64 <title>OPTIONS
</title>
69 <term><option>-w
</option></term>
71 <para>If the lock is already held by another process,
72 wait for it to complete instead of failing
78 <term><option>-W {sec}
</option></term>
80 <para>The same as -w but wait not more than sec
86 <term><option>-e
</option></term>
88 <para>Execute the program directly without forking and
89 waiting (keeps an extra file descriptor open).
</para>
94 <term><option>-E {nnn}
</option></term>
96 <para>Set the file descriptor number to keep open when
97 exec()ing (implies -e).
</para>
102 <term><option>-n
</option></term>
104 <para>Do not create the lock file if it does not
110 <term><option>-q
</option></term>
112 <para>Produce no output if lock is already held.
</para>
117 <term><option>-s
</option></term>
119 <para>Lock in shared (read) mode.
</para>
124 <term><option>-x
</option></term>
126 <para>Lock in exclusive (write) mode (default).
</para>
131 <term><option>-t
</option></term>
133 <para>Test for lock existence.
</para>
142 <title>EXIT STATUS
</title>
144 <para>If the lock was successfully acquired, the return value is that
145 of the program invoked by
<command>lckdo
</command>. If the lock
146 couldn't be acquired, EX_TEMPFAIL is returned. If there was a problem
147 opening/creating or locking the lock file, EX_CANTCREAT or EX_OSERR
148 will be returned.
</para>
153 <title>AUTHOR
</title>