Setup a cron job or scheduler for your rails application using whenever gem.

  • cd path to your project.
  • gem 'whenever', require: false add it to your gemfile
  • run bundle install
  • bundle exec wheneverize .  //This will create an initial config/schedule.rb
  • Now create your job call it  from config/schedule.rb
  • whenever --update-crontab  //update crontab
  • crontab -l  //list all cron job
  • set :output, "log/cron.log"    //if you want to set log file for cron job then that this line at the top of config/schedule.rb

        in production server:
       after deployment : 
  • bundle exec whenever
  • whenever --update-crontab
  • crontab -l



Popular posts from this blog

Wicked-PDF not showing images, 'wicked_pdf_image_tag' undefined