one.sh

one.sh is a simple Linux/BSD script which runs it arguments, but does nothing if a previous execution is still running (using a lock file.) It is ideal for use with cronjobs that run frequently (e.g. every minute) but which may have sporadic run times.

Download

Platform Version Package Size
Linux/BSD (sh) 1.0 – 2012-05-18 one.sh (right-click -> Save as…) 863 B
Git repository Development https://github.com/patrickmn/one.sh

Usage

./one.sh <command> <arguments>

Examples:
  • ./one.sh wget –mirror mywebsite.com — mirrors mywebsite.com, but does nothing if ./one.sh –mirror mywebsite.com was previously launched and is still running.
  • ./one.sh ocp http://mywebsite.com/sitemap.xml — primes the website’s cache using Optimus Cache Prime, but does nothing if the cache is already being primed.

Requirements

  • sh
  • md5sum and cut (to be able to run ./one.sh with different commands simultaneously and have a separate lock for each unique command. Edit LFILE in the script if these commands aren’t available, or if you only need a single lock.)

The above commands are available on most Linux and BSD systems.

License

No license, and no warranty.