[Backgroundrb-devel] Scheduling in backgroundrb not working
Mason Hale
masonhale at gmail.com
Wed Feb 14 11:07:17 EST 2007
Ashwin --
The schedules go in a separate file,
/config/backgroundrb_schedules.yml, not in the main backgroundrb.yml
file.
Just copy the schedule block from your backgroundrb.yml file to a new
backgroundrb_schedules.yml file, restart backgroundrb, and it should
work.
Mason
On 2/14/07, Ashwin <ashwin.bvn at azri.biz> wrote:
> Hi ,
> How do i schedule a job that can send emails at intervals of time
> using backgroundrb and rails
>
> For testing When i hit the controller i'm able send the emails.
> but that is not i intend to do .....
>
> I want to use backgroundrb and rails in which i'll schedule a job
> for every 5 minutes/ 1 minute or so..... to send an email
>
> But when i write .yml file as given by the
> http://backgroundrb.rubyforge.org/
>
> I'm unable to send emails ....... Infact my backgroundrb_server.log
> shows that scheduler is not even get triggered for every minute or
> so
>
> I've no clue y the Scheduler is not working for every 1 minute or
> so
> ........ Any help is appreciated !!!!
>
>
>
> My Server details:
>
> Ruby 1.8.4
> Rails 1.1.6
> Backgroundrb - 1.2.1
> CENT OS ..
> (Installed backgroundrb as rails plugin ie. /vendor/plugins/background...)
>
>
> ------------------------------------ backgroundrb.yml-----------------
>
> :host: localhost
> :port: 2000
> :rails_env: development
>
>
> my_scheduler:
> :class: :mailman_worker
> :job_key: :foo_name
> :worker_method: :send_emails_to_people
> :trigger_args: 0 */1 * * * * *
>
>
>
> ------------------------------------------my mailman_worker.rb --------
>
> class MailmanWorker < BackgrounDRb::Worker::RailsBase
>
> def do_work(args)
> # This method is called in it's own new thread when you
> # call new worker. args is set to :args
> # Replace this with your code
> #
> logger.info('I am in do work')
> end
>
> def send_emails_to_people
>
> @d_evals = User.find(:all,:conditions => ['id <= ?',3]
>
> for lop in @d_users
> logger.info('I am in loop')
> @user = User.find(:first, :conditions => [ 'id = ?',lop.id])
> UserNotify.deliver_people_emails(@user)
> end
>
> end
>
> end
> MailmanWorker.register
>
>
> -------------------------------------Controller code-----
>
> class TestffController < ApplicationController
>
>
> def a_pop
> MiddleMan.new_worker(:class => :mailman_worker, :job_key =>
> :foo_name)
> worker = MiddleMan.worker(:foo_name)
> worker.send_emails_to_people
> worker.delete
> end
>
> end
>
>
> --------------------------backgroundrb_server.log---------------------------------------------
>
> I am in do work
> 20070213-20:15:22 (29661) I am in send_emails_to_people
> 20070213-20:15:22 (29661) I am in loop
> 20070213-20:16:04 (29668) Starting WorkerLogger
> 20070213-20:16:05 (29669) In ResultsWorker
> 20070213-20:16:07 (29669) I am in do work
> 20070213-20:16:07 (29669) I am in send_emails_to_evaluators
> 20070213-20:16:07 (29669) I am in loop
> 20070213-20:16:13 (29669) I am in loop
> 20070213-20:16:19 (29669) I am in loop
>
> 20070214-13:40:47 (1672) Starting WorkerLogger
> 20070214-13:40:48 (1673) In ResultsWorker
> 20070214-13:41:32 (1673) I am in do work
> 20070214-13:41:32 (1673) I am in send_emails_to_people
> 20070214-13:41:33 (1673) I am in loop
> 20070214-13:41:39 (1673) I am in loop
> 20070214-13:41:46 (1673) I am in loop
>
>
> 0070214-13:45:48 (1694) Starting WorkerLogger
> 20070214-13:45:49 (1695) In ResultsWorker
>
>
>
> ------ Ashwin Kumar
>
> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel
>
More information about the Backgroundrb-devel
mailing list