From 2799f866c5c733f2b24245dc17d44076788afc92 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 16 Jan 2013 01:16:37 +0100 Subject: [PATCH] Added pid file support. --- lib/session.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/session.rb b/lib/session.rb index 3f68d8ffb..77adc0b6b 100644 --- a/lib/session.rb +++ b/lib/session.rb @@ -2,6 +2,7 @@ require 'json' module Session @path = Dir.pwd.to_s + '/tmp/websocket' + @pid = Dir.pwd.to_s + '/tmp/pids/sessionworker.pid' @@user_threads = {} @@client_threads = {} @@ -93,6 +94,12 @@ module Session def self.jobs + # create pid file + $daemon_pid = File.new( @pid.to_s,"w" ) + $daemon_pid.sync = true + $daemon_pid.puts(Process.pid.to_s) + $daemon_pid.close + # just make sure that spool path exists if !File::exists?( @path ) FileUtils.mkpath @path