<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.tbpindustries.com/index.php?action=history&amp;feed=atom&amp;title=Flock</id>
	<title>Flock - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.tbpindustries.com/index.php?action=history&amp;feed=atom&amp;title=Flock"/>
	<link rel="alternate" type="text/html" href="https://wiki.tbpindustries.com/index.php?title=Flock&amp;action=history"/>
	<updated>2026-05-14T04:15:07Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://wiki.tbpindustries.com/index.php?title=Flock&amp;diff=300&amp;oldid=prev</id>
		<title>Goldbolt: Created page with &quot;This utility manages flock locks from within shell scripts or the command line.  The first and second forms wraps the lock around the executing a command, in a manner similar...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.tbpindustries.com/index.php?title=Flock&amp;diff=300&amp;oldid=prev"/>
		<updated>2020-12-01T19:33:21Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;This utility manages flock locks from within shell scripts or the command line.  The first and second forms wraps the lock around the executing a command, in a manner similar...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This utility manages flock locks from within shell scripts or the command line.&lt;br /&gt;
&lt;br /&gt;
The first and second forms wraps the lock around the executing a command, in a manner similar to su or newgrp. It locks a specified file or directory, which is created (assuming appropriate permissions), if it does not already exist.&lt;br /&gt;
&lt;br /&gt;
The third form is convenient inside shell scripts.&lt;br /&gt;
&lt;br /&gt;
The mode used to open the file doesn't matter to flock; using &amp;gt; or &amp;gt;&amp;gt; allows the lockfile to be created if it does not already exist, however, write permission is required; using &amp;lt; requires that the file already exists but only read permission is required.&lt;br /&gt;
&lt;br /&gt;
By default, if the lock cannot be immediately acquired, flock waits until the lock is available.&lt;br /&gt;
&lt;br /&gt;
=Flags=&lt;br /&gt;
&lt;br /&gt;
-s, --shared&lt;br /&gt;
    Obtain a shared lock, sometimes called a read lock. &lt;br /&gt;
-x, -e, --exclusive&lt;br /&gt;
    Obtain an exclusive lock, sometimes called a write lock. This is the default. &lt;br /&gt;
-u, --unlock&lt;br /&gt;
    Drop a lock. This is usually not required, since a lock is automatically dropped when the file is closed. However, it may be required in special cases, for example if the enclosed command group may have forked a background process which should not be holding the lock. &lt;br /&gt;
-n, --nb, --nonblock&lt;br /&gt;
    Fail (with an exit code of 1) rather than wait if the lock cannot be immediately acquired. &lt;br /&gt;
-w, --wait, --timeout seconds&lt;br /&gt;
    Fail (with an exit code of 1) if the lock cannot be acquired within seconds seconds. Decimal fractional values are allowed. &lt;br /&gt;
-o, --close&lt;br /&gt;
    Close the file descriptor on which the lock is held before executing command. This is useful if command spawns a child process which should not be hold ing the lock. &lt;br /&gt;
-c, --command command&lt;br /&gt;
    Pass a single command to the shell with -c. &lt;br /&gt;
-h, --help&lt;br /&gt;
    Print a help message.&lt;br /&gt;
&lt;br /&gt;
=Example=&lt;br /&gt;
This will prevent rsync from running in the same manner:&lt;br /&gt;
    flock -n rsync_lock_file -c &amp;quot;rsync ...&amp;quot;&lt;/div&gt;</summary>
		<author><name>Goldbolt</name></author>
		
	</entry>
</feed>