Added pid file support.

This commit is contained in:
Martin Edenhofer 2013-01-16 01:16:37 +01:00
parent 9ebe5da994
commit 2799f866c5

View file

@ -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