Running script/runner in production environment

Following from a previous post about email scheduling with runner and cron, it turns out that the runner default behaviour is to run in the development environment.

Although by reading the help for the script/runner, there is a suggestion to run it with the -e production added to the end, it doesn’t seem to be working.

The solution to make it running in the production environment was to delete the first line (shebang) from step 3 on this post

#!/usr/bin/env /path_to_your_app/script/runner

and then use the following in the cron setup:

RAILS_ENV=production /path/to/your_ror_project/script/runner /path/to/your_ror_project/lib/email_scheduler.rb

Have a look on paragraph Alternative Usage here