Use flock to Ensure Only One Instance of a Shell Script Is Running

References:

  • Unix manual flock(1)