changelog
[moreutils.git] / lckdo.docbook
blob8a0a4a863aba57a7a4d7b06b69414c25c21dfa17
1 <?xml version="1.0" encoding="utf-8"?>
3 <!--
5 Written by Michael Tokarev <mjt@tls.msk.ru>
6 Public domain.
8 -->
10 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.4//EN"
11 "file:///usr/share/xml/docbook/schema/dtd/4.4/docbookx.dtd"
12 []>
14 <refentry>
15 <refentryinfo>
16 <address>
17 <email>mjt@tls.msk.ru</email>
18 </address>
19 <author>
20 <firstname>Michael</firstname>
21 <surname>Tokarev</surname>
22 </author>
23 <date>2007-08-15</date>
24 </refentryinfo>
26 <refmeta>
27 <refentrytitle>lckdo</refentrytitle>
28 <manvolnum>1</manvolnum>
29 </refmeta>
31 <refnamediv>
32 <refname>lckdo</refname>
33 <refpurpose>run a program with a lock held</refpurpose>
34 </refnamediv>
36 <refsynopsisdiv>
37 <cmdsynopsis>
38 <command>lckdo</command>
39 <arg>options</arg>
40 <arg choice="req">lockfile</arg>
41 <arg choice="req">program</arg>
42 <arg>arguments</arg>
43 </cmdsynopsis>
44 </refsynopsisdiv>
46 <refsect1>
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>
54 </refsect1>
56 <refsect1>
57 <title>OPTIONS</title>
59 <variablelist>
61 <varlistentry>
62 <term><option>-w</option></term>
63 <listitem>
64 <para>If the lock is already held by another process,
65 wait for it to complete instead of failing
66 immediately.</para>
67 </listitem>
68 </varlistentry>
70 <varlistentry>
71 <term><option>-W {sec}</option></term>
72 <listitem>
73 <para>The same as -w but wait not more than sec
74 seconds.</para>
75 </listitem>
76 </varlistentry>
78 <varlistentry>
79 <term><option>-e</option></term>
80 <listitem>
81 <para>Execute the program directly without forking and
82 waiting (keeps an extra file descriptor open).</para>
83 </listitem>
84 </varlistentry>
86 <varlistentry>
87 <term><option>-E {nnn}</option></term>
88 <listitem>
89 <para>Set the file descriptor number to keep open when
90 exec()ing (implies -e).</para>
91 </listitem>
92 </varlistentry>
94 <varlistentry>
95 <term><option>-n</option></term>
96 <listitem>
97 <para>Do not create the lock file if it does not
98 exist.</para>
99 </listitem>
100 </varlistentry>
102 <varlistentry>
103 <term><option>-q</option></term>
104 <listitem>
105 <para>Produce no output if lock is already held.</para>
106 </listitem>
107 </varlistentry>
109 <varlistentry>
110 <term><option>-s</option></term>
111 <listitem>
112 <para>Lock in shared (read) mode.</para>
113 </listitem>
114 </varlistentry>
116 <varlistentry>
117 <term><option>-x</option></term>
118 <listitem>
119 <para>Lock in exclusive (write) mode (default).</para>
120 </listitem>
121 </varlistentry>
123 <varlistentry>
124 <term><option>-t</option></term>
125 <listitem>
126 <para>Test for lock existence.</para>
127 </listitem>
128 </varlistentry>
130 </variablelist>
132 </refsect1>
134 <refsect1>
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>
143 </refsect1>
145 </refentry>