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 "file:///usr/share/xml/docbook/schema/dtd/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>
32 <refname>lckdo
</refname>
33 <refpurpose>run a program with a lock held
</refpurpose>
38 <command>lckdo
</command>
40 <arg choice=
"req">lockfile
</arg>
41 <arg choice=
"req">program
</arg>
47 <title>DESCRIPTION
</title>
49 <para><command>lckdo
</command> runs a program with a lock
50 held, in order to prevent multiple processes from running in
51 parallel. Use just like
<command>nice
</command> or
52 <command>nohup
</command>.
</para>
57 <title>OPTIONS
</title>
62 <term><option>-w
</option></term>
64 <para>If the lock is already held by another process,
65 wait for it to complete instead of failing
71 <term><option>-W {sec}
</option></term>
73 <para>The same as -w but wait not more than sec
79 <term><option>-e
</option></term>
81 <para>Execute the program directly without forking and
82 waiting (keeps an extra file descriptor open).
</para>
87 <term><option>-E {nnn}
</option></term>
89 <para>Set the file descriptor number to keep open when
90 exec()ing (implies -e).
</para>
95 <term><option>-n
</option></term>
97 <para>Do not create the lock file if it does not
103 <term><option>-q
</option></term>
105 <para>Produce no output if lock is already held.
</para>
110 <term><option>-s
</option></term>
112 <para>Lock in shared (read) mode.
</para>
117 <term><option>-x
</option></term>
119 <para>Lock in exclusive (write) mode (default).
</para>
124 <term><option>-t
</option></term>
126 <para>Test for lock existence.
</para>
135 <title>EXIT STATUS
</title>
137 <para>If the lock was successfully acquired, the return value is that
138 of the program invoked by
<command>lckdo
</command>. If the lock
139 couldn't be acquired, EX_TEMPFAIL is returned. If there was a problem
140 opening/creating or locking the lock file, EX_CANTCREAT or EX_OSERR
141 will be returned.
</para>