I have a background code with backgroundfu:
Simple, non-monitored worker.
class ReportWorker
def add()
Report.generate_rep()
end
end
I want this code only to run on Fridays and only to run one time every
Friday. How can I do that?
I have a background code with backgroundfu:
class ReportWorker
def add()
Report.generate_rep()
end
end
I want this code only to run on Fridays and only to run one time every
Friday. How can I do that?
John S. wrote:
I have a background code with backgroundfu:
Simple, non-monitored worker.
class ReportWorker
def add()
Report.generate_rep()
endend
I want this code only to run on Fridays and only to run one time every
Friday. How can I do that?
Sounds like a job for cron and script/runner. Or even cron and a rake
task. Doesn’t sound like you need any kind of “background”
functionality. That would seem like overkill.
How about some kind of loop? Why using cron? Is it the best option? I
have backgroundfu working.
Nathan E. wrote:
I don’t think backgroundFu is for scheduled tasks. If you use
backgroundrb, though, you can just do this:class HelloWorker < BackgrounDRb::MetaWorker
set_worker_name :hello_workerdef create(args = nil)
# time argument is in seconds
add_periodic_timer(604800) { expire_sessions }
enddef expire_sessions
# expire user sessions
end
endor if you want a more precise scheduling, use can use cron or the unix
scheduler through backgroundrb
For now, what I have done is some kink of loop with Backgroundfu. It
seems not to use a lot of CPU but I have to test it for some time.
I don’t think backgroundFu is for scheduled tasks. If you use
backgroundrb, though, you can just do this:
class HelloWorker < BackgrounDRb::MetaWorker
set_worker_name :hello_worker
def create(args = nil)
# time argument is in seconds
add_periodic_timer(604800) { expire_sessions }
end
def expire_sessions
# expire user sessions
end
end
or if you want a more precise scheduling, use can use cron or the unix
scheduler through backgroundrb
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs