Skip to content

Instantly share code, notes, and snippets.

@stevenyap
Created February 21, 2014 08:50
Show Gist options
  • Select an option

  • Save stevenyap/9130859 to your computer and use it in GitHub Desktop.

Select an option

Save stevenyap/9130859 to your computer and use it in GitHub Desktop.
Whenever - Simplify your cron job!

This gem makes creating cron jobs very easy!

  • Source: https://github.com/javan/whenever
  • After defining your crons, you need to run whenever -w to write out the crontab
  • Use crontab -l to see the list of cron jobs you have

Sample schedule.rb

set :output, {:standard => 'log/cron.log'} #logs to your log file to view

every 1.day, :at => '12:05 am' do
  runner "Notifier.run_send_reminder_emails(host: 'example.com')"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment