Skip to content

abangratz/pidlock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

Ruby Gem to lock daemons/processes via pidfile.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages