Skip to content

Instantly share code, notes, and snippets.

@Samda
Created February 3, 2021 03:51
Show Gist options
  • Save Samda/5e2dd5b6fac6f7375fc759b7b36aa520 to your computer and use it in GitHub Desktop.
Save Samda/5e2dd5b6fac6f7375fc759b7b36aa520 to your computer and use it in GitHub Desktop.
run rails jobs with crontab ubuntu 18.04LTS

#Note '/home/deploy/apps/sms_system/current' is your production directory. #edit files $crontab -e

#sample excutable file */1 * * * * /bin/bash /home/deploy/apps/sms_system/sms_system.sh #your rails jobs 1 */1 * * * * /bin/bash -l -c 'cd /home/deploy/apps/sms_system/current && RAILS_ENV=production bundle exec rails client_payment_due:import_payment_dues --silent' #your rails jobs 2 0 1 * * * /bin/bash -l -c 'cd /home/deploy/apps/sms_system/current && RAILS_ENV=production bundle exec rails send_sms:client --silent'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment