Added pid file support.
This commit is contained in:
parent
9ebe5da994
commit
2799f866c5
1 changed files with 7 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue