Skip to content
This repository was archived by the owner on Feb 9, 2022. It is now read-only.

helping setup cron tasks

skippy edited this page Sep 12, 2010 · 1 revision

setup cron

create a cron folder within your rails application root:

mkdir script/cron

ec2onrails will call any scripts located within the following directories:

  • script/cron/hourly
  • script/cron/daily
  • script/cron/weekly
  • script/cron/monthly

cron tricks

  • call a cron task as the ‘app’ user, but only for the servers in the app role
sudo -u app /usr/local/ec2onrails/bin/exec_runner -role "app" -exec "rake --trace server:hourly_tasks > /dev/null"
  • similar, but in this case limit to only running in the staging environment.
sudo -u app /usr/local/ec2onrails/bin/exec_runner -only_env 'staging' -exec "\
  rake staging db:fixtures:custom_load LOCATION=db/fixtures/examples/ > /dev/null \
  rm -rf tmp/cache/* \
"
Clone this wiki locally