FLOCK - phpMan

Command: man perldoc info search(apropos)  


FLOCK(1)                         User Commands                        FLOCK(1)



NAME
       flock - acquire a file lock and then execute a command with the lock held

SYNOPSIS
       flock [ --shared | --timeout=seconds ] lockfile command ..

DESCRIPTION
       Acquire  a file lock using the flock(2) system call and then execute the given com-
       mand with the lock held.  Depending on the options given, the lock  can  be  either
       exclusive or shared, and the behavior in the event of lock contention can be speci-
       fied as either waiting indefinitely for the lock to become available (the default),
       or  failing  if the lock does not become available after a specific time, which can
       be specified as zero to make the command not wait at all.


       --shared
              Acquire a shared lock.  Acquiring a shared lock does not  stop  others  from
              acquiring a shared lock, but it will stop others from acquiring an exclusive
              lock.  Conversely, acquiring an exclusive  lock  (the  default)  stops  both
              exclusive and shared attempts to acquire the lock.  Typically, a shared lock
              is used if a command is just going to read the locked data, and an exclusive
              lock is used if the command might write to it.

       --timeout=n
              Abort  if  the  lock  cannot be acquired before n seconds.  For a completely
              non-blocking attempt to acquire a  lock,  specify  --timeout=0.   The  timer
              applies  only  to  the  attempt to acquire the lock.  As soon as the lock is
              acquired, the timeout is cancelled.  The command to be run is not subject to
              the timeout.


EXAMPLES (invoking some imaginary programs)
       flock /etc/passwd read-and-write-to-passwd

       flock --shared /etc/passwd just-read-something-from-passwd

       flock --timeout=0 /sys /usr/local/bin/update-hotplug /sys

AUTHOR
       Written by Adam J. Richter



flock (util-linux)               November 2004                        FLOCK(1)

Generated by $Id: phpMan.php,v 4.55 2007/09/05 04:42:51 chedong Exp $ Author: Che Dong
On Apache/1.3.41 (Unix) PHP/5.2.5 mod_perl/1.30 mod_gzip/1.3.26.1a
Under GNU General Public License
2009-01-10 05:07 @38.103.63.58 CrawledBy CCBot/1.0 (+http://www.commoncrawl.org/bot.html)
Valid XHTML 1.0!Valid CSS!