Reputation: 581
I using the rufus-scheduler. There is this one function I want to call on every reboot and every 30 mins after that. I tried :
scheduler.every '30m' do
.....
end
But the first time it does the task is 30 mins after server starts. Any help?
Upvotes: 1
Views: 224
Reputation: 36402
From reading the project README file, you can use :first
with :now
or :immediately
, which schedules the job for immediate triggering. e.g.:
scheduler.every '30m', :first => :now do
.....
end
Upvotes: 2
Reputation: 3551
Do
def your_function
puts "I like spaghetti"
end
# ...
scheduler.every '30m' do
your_function()
end
your_function()
It will schedule your function every 30 minutes and then call it immediately.
Upvotes: 1