Wednesday, February 25, 2009

Crontab script for Ruby on Rails (RoR)

Recently I had to figure out a way to get RoR scripts to run from nightly crontab scripts, it took me a little while to get it working but here is the script that we ended up using to get it working. Results may very and of course if you have problems remember that permissions are usually the first place to look, then look at the path of both the folder and using "which" to make sure cron can get to the program/application.

0 9 * * 1 cd /path/to/application_root/current/ && /usr/bin/rake email:excel RAILS_ENV=production

This will run at 12:09 on Monday each week. It is running from the current directory so that we can always have the latest version of code. Have fun and note this is on Ubuntu linux.

No comments:

Post a Comment

Raspberry Pi Zero W - Wireless Configuation

create the file under "boot" folder wpa_supplicant.conf country=GB ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev u...