2

I'm new to Rails I have a system call in my action of controller.

%x [ run_my_script ]

which will run for many hours... I found once i call the system call ,i can not open the same page again, because i guess the rails was busying in waiting for the return of the sys call.

if i want to execute the page in parrallel how should i do??? using thread? I have tried sidekiq , it will consuming lots lots of memory ! is there any ideas... thanks you all in advance.

newBike
  • 14,385
  • 29
  • 109
  • 192
  • 3
    With a delayed_job ? https://rubygems.org/gems/delayed_job – pierallard Mar 01 '13 at 11:19
  • take a look at the related question about [Process](http://stackoverflow.com/questions/5949008/executing-shell-command-in-background-from-ruby-with-proper-argument-escaping) – toch Mar 01 '13 at 12:02

1 Answers1

1

You can use system command with & at the end to run it in background.. not sure if you can use with %x[]

system "run_my_script &"
Rubyman
  • 874
  • 6
  • 15