Ruby Gem to lock daemons/processes via pidfile.
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
.rspec
.travis.yml
Gemfile
Gemfile.lock
LICENSE
README.mkd
Rakefile
pidlock.gemspec

README.mkd

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)