I’ve spent way too long searching for a way to run a ruby script which
parses and ingests an xml document as named by a parameter into mysql.
on the console it works fine - script/myscript myxmlfile
I just need to be able to execute this same ruby script with a parameter
or two.
I need to be able to do this each time someone uploads a file so it
populates a database with their userid etc, so, I don’t want to use a
cron.
Someone please help me. I can’t find anything on this topic.
try this:
result = ruby /full/path/to/script.rb
(note the ` instead of ')
Davis K. wrote:
I’ve spent way too long searching for a way to run a ruby script which
parses and ingests an xml document as named by a parameter into mysql.
on the console it works fine - script/myscript myxmlfile
I just need to be able to execute this same ruby script with a parameter
or two.
I need to be able to do this each time someone uploads a file so it
populates a database with their userid etc, so, I don’t want to use a
cron.
Someone please help me. I can’t find anything on this topic.
It looks promising, but I can’t get that to work
<% result = ruby /private/var/www/myapp/script/myscript.rb
%>
Where do you suggest I put that code? And I assume you mean that I do
nothing with the result? it just prompts the code to run?
Dustin Frisell wrote:
try this:
result = ruby /full/path/to/script.rb
(note the ` instead of ')
Davis K. wrote:
I’ve spent way too long searching for a way to run a ruby script which
parses and ingests an xml document as named by a parameter into mysql.
on the console it works fine - script/myscript myxmlfile
I just need to be able to execute this same ruby script with a parameter
or two.
I need to be able to do this each time someone uploads a file so it
populates a database with their userid etc, so, I don’t want to use a
cron.
Someone please help me. I can’t find anything on this topic.
Davis K. wrote:
It looks promising, but I can’t get that to work
<% result = ruby /private/var/www/myapp/script/myscript.rb
%>
Where do you suggest I put that code? And I assume you mean that I do
nothing with the result? it just prompts the code to run?
Everything that is sent to command line will be stored in the variable
‘result’ and you can do whatever you want with it.
By the way if you want it to show, it should be
<%= ruby /private/var/www/myapp/script/myscript.rb
%>
The way you have it right now only runs the code, doesn’t display the
output from doing that.
Cheers,
Mohit.
7/12/2007 | 4:54 PM.
Hi,
I’m having the same kind of problem but on my side I would like to run
it from my controller and not from the view. Can I do that in the same
way ??
And I have to pass parameters to this script, but they are store in a
variable. Do you know how I can do that ??
Thank’s
Franz
Mohit S. wrote:
Davis K. wrote:
It looks promising, but I can’t get that to work
<% result = ruby /private/var/www/myapp/script/myscript.rb
%>
Where do you suggest I put that code? And I assume you mean that I do
nothing with the result? it just prompts the code to run?
Everything that is sent to command line will be stored in the variable
‘result’ and you can do whatever you want with it.
By the way if you want it to show, it should be
<%= ruby /private/var/www/myapp/script/myscript.rb
%>
The way you have it right now only runs the code, doesn’t display the
output from doing that.
Cheers,
Mohit.
7/12/2007 | 4:54 PM.