[英]Stop a specific job upon deploying a new version of Sinatra app
I have a rufus-scheduler job running in a Sinatra app (Phusion Passenger with NGINX). 我在Sinatra应用程序中运行rufus-scheduler作业(使用NGINX的Phusion Passenger)。 At the bottom of
app.rb
I have: 在
app.rb
的底部,我有:
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.
但是,当我使用Capistrano用新版本更新应用程序时,我注意到旧作业仍然存在,并且每隔5分钟运行一次。
How do I make sure that the old rufus-scheduler job is shutdown and the new one is started? 如何确保关闭旧的rufus-scheduler作业并启动新的?
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. 我对
rufus-scheduler
并不熟悉,但是正如我在文档中所读到的那样,它只使用线程作为日程表。 So you just need to make sure your older process has been shut down. 因此,您只需要确保您的旧进程已关闭即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.