# Kicking off external processes

**URL:** <https://www.ruby-forum.com/t/kicking-off-external-processes/113192>\
**Category:** Rails\
**Created:** [August 28, 2007, 4:31pm UTC](https://www.ruby-forum.com/t/kicking-off-external-processes/113192 "2007-08-28T16:31:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![josh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@josh](https://www.ruby-forum.com/u/josh)\
**Post date:** [August 28, 2007, 4:31pm UTC](https://www.ruby-forum.com/t/kicking-off-external-processes/113192/1 "2007-08-28T16:31:31Z")

</div>

I need to be able to kick off a (relatively) long running process that  
runs outside of the normal RoR queue. BackgrounDrb is out of the  
question pretty much because shared hosts are fond of killing it. I  
don’t necessarily need a process like backgroundrb running because I  
_don’t_ need access to these processes once they start. However, they  
_do_ need access to my models.

The solution could be as simple as kicking off an external ruby  
script, letting it run and finish all on its own.

Any ideas on this?

Thanks!

---

<div class="post-metadata">

**Author:** ![josh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@josh](https://www.ruby-forum.com/u/josh)\
**Post date:** [August 28, 2007, 5:47pm UTC](https://www.ruby-forum.com/t/kicking-off-external-processes/113192/2 "2007-08-28T17:47:40Z")

</div>

Well first of all to access your Rails code, all you need to do is in  
your  
script (assuming it’s in scripts/):

```
ENV['RAILS_ENV'] = 'production'
require File.dirname( __FILE__ ) + '/../config/environment'

```

That said, is this process initiated by user interaction? If not, then  
cron  
should work well, otherwise you could try a mix of command queuing and a  
more frequent cron job (user clicks button, command is queued up and  
will be  
run at next cron cycle).

Jason

---

<div class="post-metadata">

**Author:** ![josh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@josh](https://www.ruby-forum.com/u/josh)\
**Post date:** [August 28, 2007, 8:31pm UTC](https://www.ruby-forum.com/t/kicking-off-external-processes/113192/3 "2007-08-28T20:31:37Z")

</div>

[http://backgroundrb.rubyforge.org/](http://backgroundrb.rubyforge.org/)

by  
TheR

---

<div class="post-metadata">

**Author:** ![josh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@josh](https://www.ruby-forum.com/u/josh)\
**Post date:** [August 28, 2007, 8:32pm UTC](https://www.ruby-forum.com/t/kicking-off-external-processes/113192/4 "2007-08-28T20:32:28Z")

</div>

Damjan R. wrote:

> [http://backgroundrb.rubyforge.org/](http://backgroundrb.rubyforge.org/)
> 
> by  
> TheR

Sorry. Didn’t read all post.

by  
TheR
