SyntaxHighlighter

Saturday, January 02, 2010

Adding Cron Jobs on Engine Yard

This is a bit hard to find on Engine Yard, but it's not tricky.

To get a cron job to run, you need to go to the Dashboard and click on 'crontab' for the running instance. This will show you all Scheduled Jobs - which is probably empty at this point.



In the "Run this command..." field, you want to enter something like this if you're going run a rake task:

cd /data/app_name/current && RAILS_ENV=production rake ns:run_task

This will change directory to the app in question and run the appropriate task from the right place.

Once you have the cron job in place, you need to 'deploy' one more time. Uncheck all your checkboxes and deploy. This won't overwrite your app, but will do other things that are needed to configure the cron job. This is also true if you delete a cron job.

There is currently no way to edit a cron job. You'll have to delete the job and recreate it with changes.

2 comments:

  1. So does that mean I uncheck the box next to Deploy/Rollback at the top as well?

    ReplyDelete
  2. Anonymous7:36 PM

    Correct, you do not need anything checked to deploy/remove a cron job, or any other environmental setting, for that matter.

    ReplyDelete