-
Notifications
You must be signed in to change notification settings - Fork 0
/
unicorn.rb
28 lines (24 loc) · 835 Bytes
/
unicorn.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#setup user environment
ENV['RACK_ENV'] = 'production'
worker_processes(1)
preload_app true
# user('hosting_soobscha','plex_users')
timeout 40
# listen '/var/sockets/hosting_soobscha/deserial-production.soobscha.sock', :umask => 0117
working_directory '.'
# pid 'tmp/pids/deserial.pid'
stderr_path File.join('log', 'unicorn_stderr.log')
stdout_path File.join('log', 'unicorn_stdout.log')
#stderr_path stderr_log if File.writable? stderr_log
#stdout_path stdout_log if File.writable? stdout_log
GC.respond_to?(:copy_on_write_friendly=) and
GC.copy_on_write_friendly = true
before_fork do |server, worker|
old_pid = "#{server.config[:pid]}.oldbin"
if File.exists?(old_pid) && server.pid != old_pid
begin
Process.kill("QUIT", File.read(old_pid).to_i)
rescue Errno::ENOENT, Errno::ESRCH
end
end
end