# pidfile **Repository Path**: dimld/pidfile ## Basic Information - **Project Name**: pidfile - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-05-24 - **Last Updated**: 2021-05-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README = PidFile http://github.com/samullen/pidfile A basic library for creating lockfiles for processes This library works with Ruby 1.8 and 1.9 and is licensed under the MIT License. == Installation The pidfile gem is hosted on RubyGems.org (http://rubygems.org). This requires that you have http://rubygems.org in your gem sources. Install the pidfile gem: sudo gem install pidfile == Gettings Started The pidfile gem is easy to use and only requires the instantiation of the pidfile, like so: pf = PidFile.new Of course there is other functionality, but if you are just wanting to keep a process from running more than once, this is all you need. === Arguments PidFile creates file to store the process ID (PID). By default, process ID (PID) files are created in /tmp upon instantiation and are given the same name as the calling script with a .pid extension. Process ID files are removed when the creating program exits. Each argument, :pidfile and :piddir, can be changed upon instantiation of the class. ==== Example: PidFile.new(:piddir => '/var/lock', :pidfile => "awesome.pid") == Miscellaneous === Why isn't this a singleton? My main concern is how it would behave when a process is forked multiple times. Each new process would get its own PID, but I wasn't sure how using a singleton would affect this; if the interrelationship of the processes would keep the object from correctly identifying the correct pidfile. Anyway, I like the flexibility that not using a singleton offers, and I guess I'd rather ask you not to do something bad rather than restraining you. == Copyright Copyright(c) 2010 Samuel Mullen (samullen). See LICENSE for details