I''m trying to setup a number of recurring processes and based on the input of others have found my way to cron. I''ve made a number of attempts to setup jobs to perform any number of task, always receiving error messages. I''ve come across requests by others with the identical problem, but I''ve yet to find one that has been responded to. I''m running OS X 10.4 with all the latest Ruby/Rails installs. If I execute the following line in a Terminal window I get the expected result "Testing" ruby /Users/stocad/rrprojects/testproject/script/runner -e development "puts ''Testing''" I''ve put the following line into my crontab: 30 * * * * ruby /Users/stocad/rrprojects/testproject/script/runner -e development "puts ''Testing''" After the perscribed time has arrived (30 after any hour) I check my email (I put a .forward file in my home directory as one of the tutorials I was following suggested). My email contains the following message: /Users/stocad/rrprojects/mycms/script/../config/boot.rb:18:in `require'': No such file to load -- rubygems (LoadError) from /Users/stocad/rrprojects/testproject/script/../config/boot.rb:18 from /Users/stocad/rrprojects/testproject/script/runner:2:in `require'' from /Users/stocad/rrprojects/testproject/script/runner:2 There are a good number of resources out there telling me what to do if I''m missing rubygems altogether, but rubygems seems to be working for me in all cases except when I attempt to run a ruby script through cron. Any assistance would be greatly appreciated. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I''m trying to setup a number of recurring processes and based on the input of others have found my way to cron. I''ve made a number of attempts to setup jobs to perform any number of task, always receiving error messages. I''ve come across requests by others with the identical problem, but I''ve yet to find one that has been responded to. I''m running OS X 10.4 with all the latest Ruby/Rails installs. If I execute the following line in a Terminal window I get the expected result "Testing" ruby /Users/stocad/rrprojects/testproject/script/runner -e development "puts ''Testing''" I''ve put the following line into my crontab: 30 * * * * ruby /Users/stocad/rrprojects/testproject/script/runner -e development "puts ''Testing''" After the perscribed time has arrived (30 after any hour) I check my email (I put a .forward file in my home directory as one of the tutorials I was following suggested). My email contains the following message: /Users/stocad/rrprojects/mycms/script/../config/boot.rb:18:in `require'': No such file to load -- rubygems (LoadError) from /Users/stocad/rrprojects/testproject/script/../config/boot.rb:18 from /Users/stocad/rrprojects/testproject/script/runner:2:in `require'' from /Users/stocad/rrprojects/testproject/script/runner:2 There are a good number of resources out there telling me what to do if I''m missing rubygems altogether, but rubygems seems to be working for me in all cases except when I attempt to run a ruby script through cron. Any assistance would be greatly appreciated. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I''ve never used script/runner in a cron job, but I have used cron with Rails. I put bitsweat_wears_sneakers.rb in lib (or wherever). After the shebang, I plop in require ''/full/path/to/my/awesome/app/config/environment.rb'' The invocation would be something like 30 * * * * ruby /Users/stocad/rrprojects/testproject/lib/ bitsweat_wears_sneakers .rb The full path thingee isn''t too portable if your dev and production setups are different. You could do some checking to see whether ../ config/environment.rb (or some other environment.rb) exists and require it if it does. Is there an easier way, list? On Aug 24, 2006, at 6:08 PM, Aaron Stockton wrote:> I''m trying to setup a number of recurring processes and based on the > input of others have found my way to cron. I''ve made a number of > attempts to setup jobs to perform any number of task, always receiving > > error messages. I''ve come across requests by others with the > identical > problem, but I''ve yet to find one that has been responded to. > > I''m running OS X 10.4 with all the latest Ruby/Rails installs. > > If I execute the following line in a Terminal window I get the > expected > > result "Testing" > ruby /Users/stocad/rrprojects/testproject/script/runner -e development > "puts ''Testing''" > > I''ve put the following line into my crontab: > 30 * * * * ruby /Users/stocad/rrprojects/testproject/script/runner -e > > development "puts ''Testing''" > > After the perscribed time has arrived (30 after any hour) I check my > email (I put a .forward file in my home directory as one of the > tutorials I was following suggested). My email contains the following > > message: > > /Users/stocad/rrprojects/mycms/script/../config/boot.rb:18:in > `require'': No such file to load -- rubygems (LoadError) > from > /Users/stocad/rrprojects/testproject/script/../config/boot.rb:18 > > from /Users/stocad/rrprojects/testproject/script/runner:2:in > `require'' > from /Users/stocad/rrprojects/testproject/script/runner:2 > > There are a good number of resources out there telling me what to > do if > > I''m missing rubygems altogether, but rubygems seems to be working for > me in all cases except when I attempt to run a ruby script through > cron. > > Any assistance would be greatly appreciated. > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
you could also use BackgrounDRb for that purpose, since it kind-of emulates cron. altough it can do many many other things 2006/8/25, Aaron Stockton <stocad-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> > I''m trying to setup a number of recurring processes and based on the > input of others have found my way to cron. I''ve made a number of > attempts to setup jobs to perform any number of task, always receiving > > error messages. I''ve come across requests by others with the identical > problem, but I''ve yet to find one that has been responded to. > > I''m running OS X 10.4 with all the latest Ruby/Rails installs. > > If I execute the following line in a Terminal window I get the expected > > result "Testing" > ruby /Users/stocad/rrprojects/testproject/script/runner -e development > "puts ''Testing''" > > I''ve put the following line into my crontab: > 30 * * * * ruby /Users/stocad/rrprojects/testproject/script/runner -e > > development "puts ''Testing''" > > After the perscribed time has arrived (30 after any hour) I check my > email (I put a .forward file in my home directory as one of the > tutorials I was following suggested). My email contains the following > > message: > > /Users/stocad/rrprojects/mycms/script/../config/boot.rb:18:in > `require'': No such file to load -- rubygems (LoadError) > from > /Users/stocad/rrprojects/testproject/script/../config/boot.rb:18 > > from /Users/stocad/rrprojects/testproject/script/runner:2:in > `require'' > from /Users/stocad/rrprojects/testproject/script/runner:2 > > There are a good number of resources out there telling me what to do if > > I''m missing rubygems altogether, but rubygems seems to be working for > me in all cases except when I attempt to run a ruby script through > cron. > > Any assistance would be greatly appreciated. > > > > >-- Michael Siebert <info-norLuBQQNv0t+8dGM1inlw@public.gmane.org> www.siebert-wd.de - Gedanken lesen www.stellar-legends.de - Weltraum-Browsergame im Alpha-Stadium --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Zach, I tried running with an rb file first, and created an arrangement much as you have described. This was where I initially came across the error message. After poking around I came to the conclusion that the runner script was the environment setup for quickly issuing single commands, which is really what I want to do anyway. Either way the error message I posted occurs in poth situations. Michael, BackgrounDRb to my understanding was created to issue long running processes without delaying a pages load. I guess I could adapt that to work, but if I understand correctly the best tool for issuing batch style processing is cron. I don''t mean to sound ungrateful, but if possible I''d prefer to figure out why it isn''t working rather than installing a work around. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
cron runs in a very limited environment, without all the environment variables set like you have in a login session. You probably need to add something to the load path, although I haven''t used rails via cron so I can''t tell you specifically what to do. That''s where to look though. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
2006/8/25, Aaron <stocad-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> Michael, BackgrounDRb to my understanding was created to issue long > running processes without delaying a pages load. I guess I could adapt > that to work, but if I understand correctly the best tool for issuing > batch style processing is cron.With the new autostart feature, a worker can be started when backgroundrb is started and with repeat_every class method you can control how often the job is executed. this works great for me and i think its good not having to administer additional software. I don''t mean to sound ungrateful, but if possible I''d prefer to figure> out why it isn''t working rather than installing a work around.you could also possibly try to use a rake task like this: task :name => :environment do blah end this way you loaded your environment (determined by ENV[''RAILS_ENV'' ]) and have access to all other rails-specific stuff. I''d prefer that since i think it can be tested better (and i never used runner) -- Michael Siebert <info-norLuBQQNv0t+8dGM1inlw@public.gmane.org> www.siebert-wd.de - Gedanken lesen www.stellar-legends.de - Weltraum-Browsergame im Alpha-Stadium --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Aaron, I just tried the script/runner approach. It worked, the differences being the path and the frequency. Can you tell cron to send you the location of the ruby it uses? Like by running which ruby Then make sure it''s the ruby you think it is? On Aug 24, 2006, at 11:50 PM, Aaron wrote:> > Zach, I tried running with an rb file first, and created an > arrangement much as you have described. This was where I initially > came across the error message. After poking around I came to the > conclusion that the runner script was the environment setup for > quickly > issuing single commands, which is really what I want to do anyway. > Either way the error message I posted occurs in poth situations. > > Michael, BackgrounDRb to my understanding was created to issue long > running processes without delaying a pages load. I guess I could > adapt > that to work, but if I understand correctly the best tool for issuing > batch style processing is cron. > > I don''t mean to sound ungrateful, but if possible I''d prefer to figure > out why it isn''t working rather than installing a work around. > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Zach, It worked. I used "which ruby" to compare the environments inside and outside of cron (they where different). I just had to set a different PATH within my crontab to get it to use the correct install of ruby. Once I added that line it works like a charm. Thanks everyone for all your assistance. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Mazel tov. On Aug 25, 2006, at 10:09 AM, Aaron wrote:> Zach, It worked. I used "which ruby" to compare the environments > inside and outside of cron (they where different). I just had to > set a > different PATH within my crontab to get it to use the correct install > of ruby. Once I added that line it works like a charm. Thanks > everyone for all your assistance.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Aaron wrote:> I''ve put the following line into my crontab: > 30 * * * * ruby /Users/stocad/rrprojects/testproject/script/runner -e > development "puts ''Testing''"It looks to me like you need to add a PATH line before the above -- the standard system path doesn''t include the path to your Ruby installation. Just type echo $PATH in a term window, and copy what you get. Then add the line PATH=<whatever you got> at the top of your crontab. Hope this helps. --Al Evans -- 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 -~----------~----~----~----~------~----~------~--~---