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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
try this: result = `ruby /full/path/to/script.rb` (note the ` instead of '') Davis Kitchel 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.-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 Kitchel 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.-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Davis Kitchel 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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 Sindhwani wrote:> Davis Kitchel 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.-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---