Comment on page
Every driver can schedule events to occur in a number of different ways. Schedules are automatically cleared when a driver is terminated.
- Integer arguments are in milliseconds.
1000== 1 second
- Strings can be used for a friendly representation of the time
'30s'== 30 seconds
'5m'== 5 minutes
'1w2d3h5m'== 1 week, 2 days, 3 hours and 5 minutes
'2Y1M'== 2 years, 1 month
# perform some action, such as polling
schedule.at(Time.now + 2.hours) do
# Every day at 8am
schedule.cron('0 8 * * *') do
# Canceling an individual schedule
@email_sched = schedule.in(500) do
There are often situations where you want to run the block immediately.
schedule.every('1m', :run_now) do
CRON also supports time zones - which should always be configured
schedule.cron('0 8 * * *', timezone: 'Sydney') do