Search code examples
ruby-on-railssidekiqsidekiq-cron

Sidekiq Scheduler - Rails - Run a Worker On 2nd of every Month


Using sidekiq-scheduler, how can we schedule a worker to run 2nd of every month on a specified time?

import_worker:
  every: '0 0 * 1 *'
  class: ImportWorker
  queue: scheduler
  enabled: true

Will the above cron run every one month? Also how can I specify time here?


Solution

  • You want cron, not every. cron format is minute, hour, day of month, month, day of week. 0 0 * 1 * says to run every day of January at midnight. To run on the 2nd of every month at 12:30 would be 30 12 2 * *.

    import_worker:
      cron: '30 12 2 * *'
      class: ImportWorker
      queue: scheduler