I'm trying to run a console script from my crontab but I'm getting a console error. It works fun when I run it from the command line. I'm guessing there's an environment variable I need to set but what is it? Anyone have any advice?
I'm calling it like this: /Users/alex/links/script/console production < /Users/Alex/links/digg.rb
look into script/runner. It is meant to do these sorts of things...
So...
say you have RAILS_ROOT/lib/foo.rb:
class Foo def self.foobar #do your stuff here end end
you could then do:
RAILS_ROOT/script/runner "Foo.foobar" -e production
What's nice is that you can use any of your models class methods as well...
-philip