Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- begin
- File.open(PID_FILE, ::File::CREAT | ::File::EXCL | ::File::WRONLY){|f| f.write("#{Process.pid}") }
- at_exit { File.delete(PID_FILE) if File.exists?(PID_FILE) }
- rescue Errno::EEXIST
- check_pid
- retry
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement