# Starting/Stopping a process via web interface?

**URL:** <https://www.ruby-forum.com/t/starting-stopping-a-process-via-web-interface/61112>\
**Category:** Rails\
**Created:** [May 20, 2006, 9:39am UTC](https://www.ruby-forum.com/t/starting-stopping-a-process-via-web-interface/61112 "2006-05-20T09:39:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [May 20, 2006, 9:39am UTC](https://www.ruby-forum.com/t/starting-stopping-a-process-via-web-interface/61112/1 "2006-05-20T09:39:23Z")

</div>

'Sup everybody?!

I’ll be wanting to start/stop a background process via RoR’s web  
interface (probably by clicking a form button). When activated, this  
process will do its stuff perpetually, until deactivated again. Any  
ideas how to go about this? cron would probably be involved.

Thanks,  
Joe

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [May 20, 2006, 11:23pm UTC](https://www.ruby-forum.com/t/starting-stopping-a-process-via-web-interface/61112/2 "2006-05-20T23:23:27Z")

</div>

Joe wrote:

> . Any  
> ideas how to go about this? cron would probably be involved.

ruby has a system() function… you could use that? i’d be very cautious  
tho, given the obvious security concerns opening up your system i.e.  
don’t pass in the variable as a parameter and then send to the system  
call, cause someone might pass in ‘mail removed\_email\_address@domain.invalid \< /etc/passwd’  
er something drastic like that. .

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [May 21, 2006, 1:30am UTC](https://www.ruby-forum.com/t/starting-stopping-a-process-via-web-interface/61112/3 "2006-05-21T01:30:07Z")

</div>

Joe wrote:

> 'Sup everybody?!
> 
> I’ll be wanting to start/stop a background process via RoR’s web  
> interface (probably by clicking a form button). When activated, this  
> process will do its stuff perpetually, until deactivated again. Any  
> ideas how to go about this? cron would probably be involved.
> 
> Thanks,  
> Joe

Nagios (a network monitoring app) has a command file that the web  
interface writes to. Then another background process periodically reads  
that file and executes commands within.

You could do the same using a database as well which would avoid some  
locking issues…

Just be sure you sanatize the input. Even better, write a code like  
“START\_FOO” which when read will run a specific command. That will make  
it a lot harder to hijack.
