run-one is a wrapper script that won't run the given command while another instance of it is running. Is brings several utility commands that offer similar behavior.
NAME
       run-one - run just one instance at a time of some command and unique set of arguments (useful for cronjobs, eg)
SYNOPSIS
       run-one COMMAND [ARGS]
       run-this-one COMMAND [ARGS]
       run-one-constantly COMMAND [ARGS]
       keep-one-running COMMAND [ARGS]
       run-one-until-success COMMAND [ARGS]
       run-one-until-failure COMMAND [ARGS]
DESCRIPTION
       run-one is a wrapper script that runs no more than one unique instance of some command with a unique set of arguments.
       This is often useful with cronjobs, when you want no more than one copy running at a time.
       run-this-one  is  exactly  like run-one, except that it will use pgrep(1) and kill(1) to find and kill any running processes owned by the user
       and matching the target commands and arguments.  Note that run-this-one will block while trying to kill matching processes, until all matching
       processes are dead.
       run-one-constantly operates exactly like run-one except that it respawns "COMMAND [ARGS]" any time COMMAND exits (zero or non-zero).
       keep-one-running is an alias for run-one-constantly.
       run-one-until-success  operates exactly like run-one-constantly except that it respawns "COMMAND [ARGS]" until COMMAND exits successfully (ie,
       exits zero).
       run-one-until-failure operates exactly like run-one-constantly except that it respawns "COMMAND [ARGS]" until COMMAND exits with failure  (ie,
       exits non-zero).
  Internally
  
    Show archive.org snapshot
  
, it hashes command+arguments and flocks on the hash.
Posted by Dominik Schöler to makandra dev (2017-03-07 10:07)