I have a rufus-scheduler job running in a Sinatra app (Phusion Passenger with NGINX). At the bottom of app.rb I have:
scheduler.every '5m' do
do_something_cool
end
It get's the job running. But when I use Capistrano to update the app with a new version, I notice that the old job is still present and each run at the 5 minute interval.
How do I make sure that the old rufus-scheduler job is shutdown and the new one is started?
I've tried adding this at the bottom:
at_exit do
if scheduler
scheduler.shutdown
end
end
But that did not work.
I'm not familiar with
rufus-scheduler, but as I read in the documentation, it just uses threads for the schedule. So you just need to make sure your older process has been shut down.