class Daemons::PidFile
def initialize(dir, progname, multiple = false)
def initialize(dir, progname, multiple = false) @dir = File.expand_path(dir) @progname = progname @multiple = multiple @number = nil @number = 0 if multiple if multiple while File.exist?(filename) && @number < 1024 @number += 1 end if @number >= 1024 fail RuntimeException('cannot run more than 1024 instances of the application') end end end