EnglishFrenchSpanish

OnWorks favicon

lockfile - Online in the Cloud

Run lockfile in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command lockfile that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

PROGRAM:

NAME


lockfile - conditional semaphore-file creator

SYNOPSIS


lockfile -sleeptime | -r retries |
-l locktimeout | -s suspend | -! | -ml | -mu | filename ...

DESCRIPTION


lockfile can be used to create one or more semaphore files. If lockfile can't create all
the specified files (in the specified order), it waits sleeptime (defaults to 8) seconds
and retries the last file that didn't succeed. You can specify the number of retries to
do until failure is returned. If the number of retries is -1 (default, i.e., -r-1)
lockfile will retry forever.

If the number of retries expires before all files have been created, lockfile returns
failure and removes all the files it created up till that point.

Using lockfile as the condition of a loop in a shell script can be done easily by using
the -! flag to invert the exit status. To prevent infinite loops, failures for any
reason other than the lockfile already existing are not inverted to success but rather are
still returned as failures.

All flags can be specified anywhere on the command line, they will be processed when
encountered. The command line is simply parsed from left to right.

All files created by lockfile will be read-only, and therefore will have to be removed
with rm -f.

If you specify a locktimeout then a lockfile will be removed by force after locktimeout
seconds have passed since the lockfile was last modified/created (most likely by some
other program that unexpectedly died a long time ago, and hence could not clean up any
leftover lockfiles). Lockfile is clock skew immune. After a lockfile has been removed by
force, a suspension of suspend seconds (defaults to 16) is taken into account, in order to
prevent the inadvertent immediate removal of any newly created lockfile by another program
(compare SUSPEND in procmail(1)).

Mailbox locks
If the permissions on the system mail spool directory allow it, or if lockfile is suitably
setgid, it will be able to lock and unlock your system mailbox by using the options -ml
and -mu respectively.

EXAMPLES


Suppose you want to make sure that access to the file "important" is serialised, i.e., no
more than one program or shell script should be allowed to access it. For simplicity's
sake, let's suppose that it is a shell script. In this case you could solve it like this:
...
lockfile important.lock
...
access_"important"_to_your_hearts_content
...
rm -f important.lock
...
Now if all the scripts that access "important" follow this guideline, you will be assured
that at most one script will be executing between the `lockfile' and the `rm' commands.

ENVIRONMENT


LOGNAME used as a hint to determine the invoker's loginname

Use lockfile online using onworks.net services


Free Servers & Workstations

Download Windows & Linux apps

  • 1
    KDiff3
    KDiff3
    This repository is no longer maintained
    and is kept for archival purposes. See
    https://invent.kde.org/sdk/kdiff3 for
    the newest code and
    https://download.kde.o...
    Download KDiff3
  • 2
    USBLoaderGX
    USBLoaderGX
    USBLoaderGX is a GUI for
    Waninkoko's USB Loader, based on
    libwiigui. It allows listing and
    launching Wii games, Gamecube games and
    homebrew on Wii and WiiU...
    Download USBLoaderGX
  • 3
    Firebird
    Firebird
    Firebird RDBMS offers ANSI SQL features
    & runs on Linux, Windows &
    several Unix platforms. Features
    excellent concurrency & performance
    & power...
    Download Firebird
  • 4
    KompoZer
    KompoZer
    KompoZer is a wysiwyg HTML editor using
    the Mozilla Composer codebase. As
    Nvu's development has been stopped
    in 2005, KompoZer fixes many bugs and
    adds a f...
    Download KompoZer
  • 5
    Free Manga Downloader
    Free Manga Downloader
    The Free Manga Downloader (FMD) is an
    open source application written in
    Object-Pascal for managing and
    downloading manga from various websites.
    This is a mirr...
    Download Free Manga Downloader
  • 6
    UNetbootin
    UNetbootin
    UNetbootin allows you to create bootable
    Live USB drives for Ubuntu, Fedora, and
    other Linux distributions without
    burning a CD. It runs on Windows, Linux,
    and ...
    Download UNetbootin
  • More »

Linux commands

  • 1
    abc2abc
    abc2abc
    abc2abc - a simple abc
    checker/re-formatter/transposer ...
    Run abc2abc
  • 2
    abc2ly
    abc2ly
    abc2ly - manual page for abc2ly
    (LilyPond) 2.18.2 ...
    Run abc2ly
  • 3
    coqdoc
    coqdoc
    coqdoc - A documentation tool for the
    Coq proof assistant ...
    Run coqdoc
  • 4
    coqide
    coqide
    coqide - The Coq Proof Assistant
    graphical interface ...
    Run coqide
  • 5
    g.gui.vdigitgrass
    g.gui.vdigitgrass
    g.gui.vdigit - Interactive editing and
    digitization of vector maps. KEYWORDS:
    general, user interface, GUI, vector,
    editing, digitizer ...
    Run g.gui.vdigitgrass
  • 6
    g.listgrass
    g.listgrass
    g.list - Lists available GRASS data
    base files of the user-specified data
    type optionally using the search
    pattern. KEYWORDS: general, map
    management, list ...
    Run g.listgrass
  • More »

Ad