开发者

Trying to start redis and resque scheduler within a rake task

I want to start redis and redis-scheduler from a rake开发者_StackOverflow中文版 task so I'm doing the following:

namespace :raketask do
  task :start do
    system("QUEUE=* rake resque:work &")
    system("rake redis:start")
    system("rake resque:scheduler")
  end
end

The problem is the redis starts in the foreground and then this never kicks off the scheduler. If It won't start in the background (using &). Scheduler must be started AFTER redis is up and running.


similar to nirvdrum. The resque workers are going to fail/quit if redis isn't already running and accepting connections.

check out this gist for an example of how to get things started with monit (linux stuff).

Monit allows one service to be dependent on another, and makes sure they stay alive by monitoring a .pid file.


That strikes me as not a great idea. You should have your redis server started via an init script or something. But, if you really want to go this way, you probably need to modify your redis:start task to use nohup and background the process so you can disconnect from the TTY and keep the process running.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜