守护任务 [英] Daemoninsing a rake task

查看:75
本文介绍了守护任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个rake任务,它在rails环境下运行mailman。

I have a rake task which runs mailman under the rails environment.

我想确保rake任务始终通过守护程序运行。

I'd like to ensure that rake task is always running via a daemon.

我的耙子任务是耙入邮件

我要如何去

推荐答案

如果您使用的是Linux,则可以考虑使用start-stop-daemon。

If you are on linux you could consider using start-stop-daemon.

start-stop-daemon -S --pidfile /var/run/incoming_mail.pid -u rails_user -d / path / to / your / rails / app -b -a耙入邮件

稍后,您可以使用大多数参数来优雅地终止进程,但可以使用- S与-K。

To later gracefully kill the process you can use most of the arguments but replace -S with -K.

与往常一样,您可以通过阅读手册页找到有关start-stop-daemon的更多信息。

As always you can find more information on start-stop-daemon by reading the man pages.

这篇关于守护任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆