Project

pidlock

0.0
No commit activity in last 3 years
No release in over 3 years
Used for locking processes via PID and file (daemon style).
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Pidlock

Build Status

This is a ruby library for using pid-file based locking of programs/daemons to prevent multiple parallel running tasks.

Prerequisites

The gem sys/proctable is required.

Usage

require 'sys/proctable'

pidlock = Pidlock.new('my.pid')   # Instantiates a lock
pidlock.lock                      # tries to create a lock file '/var/run/my.pid';
                                  # raises an error if the file is locked or a program exists that
                                  # has the same basename and pid (here: 'my')
...
pidlock.unlock                    # closes and removes the file

TODO

  • test unlocking in projects.

LICENSE

ISC License

CONTRIBUTORS

  • Greg Whiteley (https:/github/com/whitty)