Search code examples
ruby-on-railscronruby-on-rails-pluginsdelayed-jobwhenever

Delayed_Job - on site5 server


I am currently using a site5 server and would like rake jobs:work pretty much running all the time. I currently cannot send out the jobs unless i'm logged into the server. I hope that someone out there can help me with this. Had alot of trouble with ar_mailer and the whenever gem ... but have about another 5 gems working perfectly within my rails app.

can someone shed some light on a solution for this please? greatly appreciated. (installed delayed_job as a plugin)


Solution

  • OK I have a workaround for this, it's the best I can do but it works to some degree ... I made use of CRON jobs and a custom script/jobrunner file.

    I created the jobrunner script located at script/jobrunner which contains the following

    #!/usr/bin/env ruby
    require File.dirname(__FILE__) + '/../config/environment'
    Delayed::Worker.new.start
    

    Then in a cron job i made it run that file.

    In the cron report i still get a few errors, but the jobs run and i'm happy with that!

    The cron job is running every hour on the 50th minute for example, and it goes through all the delayed_jobs in the table and processes them. This is the next best workaround solution that i have found to my problem. hope this helps someone out in the future.

    Going to see what other scripts i can conjure up for daily/weekly tasks.