# Simulating script/console for backend process

**URL:** <https://discuss.rubyonrails.org/t/simulating-script-console-for-backend-process/39778>\
**Category:** rubyonrails-talk\
**Created:** [February 25, 2009, 4:20pm UTC](https://discuss.rubyonrails.org/t/simulating-script-console-for-backend-process/39778 "2009-02-25T16:20:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mauricio\_Linhares1](https://avatars.discourse-cdn.com/v4/letter/m/eada6e/32.png) [@Mauricio\_Linhares1](https://discuss.rubyonrails.org/u/Mauricio_Linhares1)\
**Post date:** [February 25, 2009, 4:20pm UTC](https://discuss.rubyonrails.org/t/simulating-script-console-for-backend-process/39778/1 "2009-02-25T16:20:08Z")

</div>

Go to your RAILS\_ROOT folder and then:

script/runner "here goes the name of your script" -e production

Read the help:

script/runner -h Usage: script/runner [options] ('Some.ruby(code)' or a filename)

&nbsp;&nbsp;&nbsp;&nbsp;-e, --environment=name Specifies the environment for the runner to operate under (test/development/production). &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: development

&nbsp;&nbsp;&nbsp;&nbsp;-h, --help Show this help message.

You can also use runner as a shebang line for your scripts like this:

---

<div class="post-metadata">

**Author:** ![Sarah\_Mei](https://avatars.discourse-cdn.com/v4/letter/s/3bc359/32.png) [@Sarah\_Mei](https://discuss.rubyonrails.org/u/Sarah_Mei)\
**Post date:** [February 26, 2009, 1:27am UTC](https://discuss.rubyonrails.org/t/simulating-script-console-for-backend-process/39778/2 "2009-02-26T01:27:14Z")

</div>

Generally, you want to put this sort of thing in a rake task (instead of a script) and then your cron is just cd /application\_rails\_directory; rake do\_my\_thing --RAILS\_ENV=production
