Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Only run at_exit code if we're the boss

  • Loading branch information...
commit 89ed5c78a6e71bb0522a5faa44bb03b2cfd28211 1 parent 58498f1
Brian Underwood authored
Showing with 12 additions and 2 deletions.
  1. +12 −2 bin/job_boss
View
14 bin/job_boss
@@ -24,9 +24,19 @@ Daemons.run_proc('job_boss', daemons_options) do
Dir.chdir(JobBoss::Boss.config.application_root)
- require 'config/environment' if File.exist?('config/environment.rb')
-
boss = JobBoss::Boss.new
+ if File.exist?('config/environment.rb')
+ boss.logger.info "Requiring 'config/environment.rb'"
+ require 'config/environment'
+ end
+
+ at_exit do
+ if BOSS_PID == Process.pid
+ boss.stop
+ boss = JobBoss::Boss.new
+ end
+ end
+
boss.start
end
Please sign in to comment.
Something went wrong with that request. Please try again.