如何在rails的后台运行rake任务 [英] how to run rake task in background in rails

查看:73
本文介绍了如何在rails的后台运行rake任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的命令

bundle exec rake resque:work QUEUE="*" --trace

我想在我的服务器上运行此命令作为后台进程.

I want to run this command on my server as a background process.

请帮帮我.

推荐答案

我经常使用的一个方法是:

A method I often use is:

nohup bundle exec rake resque:work QUEUE="*" --trace > rake.out 2>&1 &

即使您退出 shell,这也会使任务继续运行.然后,如果我只想实时观察跟踪输出,我会这样做:

This will keep the task running even if you exit your shell. Then if I want to just observe trace output live, I do:

tail -f rake.out

您可以随时检查 rake.out.

And you can examine rake.out at any time.

如果需要在完成前杀掉,可以用ps找到并杀掉pid.

If you need to kill it before completion, you can find it with ps and kill the pid.

这篇关于如何在rails的后台运行rake任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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