我正在嘗試使用resque scheduler,但我無法找到一個很好的方法來監視該進程。 我想要的是在任何部署後終止調度程序作業,並讓其重新啓動它。 我寫了一個腳本Capistrano的殺resque調度resque scheduler upstart
task :stop_scheduler => :environment do
pidfile = Rails.root + "tmp/pids/resque_scheduler.pid"
if File.exists?(pidfile)
pid = File.read(pidfile).to_i
syscmd = "kill -s QUIT #{pid}"
puts "Running syscmd: #{syscmd}"
system(syscmd)
FileUtils.rm_f(pidfile)
else
puts "****WARNING**** Scheduler pid file has not been found. Was scheduler running??"
end
end
此時新貴將重新啓動它。 我的問題可能是與新貴conf。我需要Schduler在tmp/pids/resque_scheduler.pid中寫入PID,以便能夠在下次重新啓動時將其終止。
這裏是我的暴發戶的conf重要的部分:
respawn
respawn limit 99 5
console none
script
su -c "source 'cd /myapp/; RAILS_ENV={env} bundle exec rake resque:scheduler BACKGROUND=yes PIDFILE=./tmp/pids/resque_scheduler.pid >> ~/resque_workers.log 2>&1" my_user
end script
使用這種構形的我有一個調度叉其他時間,我已經寫在我的了pidfile PID是不正確的效果。我結束了一個不斷重生的過程,我不能再殺了。
有什麼建議嗎?