Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to start redis and resque scheduler within a rake task

I want to start redis and redis-scheduler from a rake 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.

like image 735
Arthur Frankel Avatar asked Feb 02 '26 07:02

Arthur Frankel


1 Answers

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.

like image 59
nessur Avatar answered Feb 04 '26 01:02

nessur



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!