Is Rails's “delayed_job” for cron task really?

I worked on a project that tried to use DelayedJob to schedule future items. It sucked Instead I recommend you use the whenever gem: github.com/javan/whenever Whenever is a Ruby gem that provides a clear syntax for defining cron jobs. It outputs valid cron syntax and can even write your crontab file for you.It is designed to work well with Rails applications and can be deployed with Capistrano.

Whenever works fine independently as well Code looks like this (from github) every 3. Hours do runner "MyModel. Some_process" rake "my:rake:task" command "/usr/bin/my_great_command" end every 1.

Day, :at => '4:30 am' do runner "MyModel. Task_to_run_at_four_thirty_in_the_morning" end every :hour do # Many shortcuts available: :hour, :day, :month, :year, :reboot runner "SomeModel. Ladeeda" end every :sunday, :at => '12pm' do # Use any day of the week or :weekend, :weekday runner "Task.

Do_something_great" end Here s a RailsCast video on how to use it And the corresponding ASCIICast.

I worked on a project that tried to use DelayedJob to schedule future items. It sucked. Instead I recommend you use the whenever gem: github.com/javan/whenever Whenever is a Ruby gem that provides a clear syntax for defining cron jobs.It outputs valid cron syntax and can even write your crontab file for you.

It is designed to work well with Rails applications and can be deployed with Capistrano. Whenever works fine independently as well. Code looks like this (from github) every 3.

Hours do runner "MyModel. Some_process" rake "my:rake:task" command "/usr/bin/my_great_command" end every 1. Day, :at => '4:30 am' do runner "MyModel.

Task_to_run_at_four_thirty_in_the_morning" end every :hour do # Many shortcuts available: :hour, :day, :month, :year, :reboot runner "SomeModel. Ladeeda" end every :sunday, :at => '12pm' do # Use any day of the week or :weekend, :weekday runner "Task. Do_something_great" end Here's a RailsCast video on how to use it.

And the corresponding ASCIICast.

I think cron is a better tool for this than delayed_job. I've used it in a project before, and it really excels at running at task in the background or at a particular time. But, for recurring tasks that happen at regular times, I think cron is the best tool.

Check out whenever (and its Railscast) to easily schedule cron jobs that can run rake tasks (or thor, or shell scripts, or anything else. ) You can use the rake tasks to update your models and then have some sort of dashboard controller that looks at the various statuses.

Whenever works great. I also like rufus-scheduler /config/initializers/task_scheduler. Rb Then in that file: scheduler = Rufus::Scheduler.

Start_new scheduler. Every("1m") do DailyDigest. Send_digest!

End I originally found this posted here I've tried it and it works well. Update Now that I look back at that link it's pretty much the only rails company that I would want to work for. They have made some many gems and add such much to the community.

Not to mention they have a huge team!

I run multiple cron delayed_jobs for nightly statistic and report generating and also for data scrapping at certain intervals. Here's how I do it: aaronvb.com/blog/2010/10/27/recurring-de....

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions