[Rails] Problem with cron and a rails script

LANFusion
Sat, 12 Aug 2006 18:34:21 -0000

I''m trying to run a rails script using cron and I keep getting the
following
error:

/home/domains/lists.lanfusion.com/script/../config/boot.rb:18:in
`require'':
no such file to load -- rubygems (LoadError)
        from /home/domains/lists.lanfusion.com/script/../config/boot.rb:18
        from /home/domains/lists.lanfusion.com/script/runner:2

When I run the script from ssh it runs without a problem. I''ve tried
the
following cron lines in the /etc/crontab file with the same results:

00 * * * * lanfusion ruby /home/domains/lists.lanfusion.com/script/runmail
00 * * * * lanfusion /home/domains/lists.lanfusion.com/script/runmail
00 * * * * lanfusion /home/domains/lists.lanfusion.com/script/runner
''load
"runmail"''
00 * * * * lanfusion cd /home/domains/lists.lanfusion.com/;ruby
script/runmail
00 * * * * lanfusion cd /home/domains/lists.lanfusion.com/;script/runmail
00 * * * * root ruby /home/domains/lists.lanfusion.com/script/runmail
00 * * * * root /home/domains/lists.lanfusion.com/script/runmail
00 * * * * root /home/domains/lists.lanfusion.com/script/runner ''load
"runmail"''
00 * * * * root cd /home/domains/lists.lanfusion.com/;ruby script/runmail
00 * * * * root cd /home/domains/lists.lanfusion.com/;script/runmail

The runmail script is part of a mailing list application. Here''s the
code:

#!/usr/bin/env ruby
require ''net/pop''
require File.dirname(__FILE__) + ''/../config/environment''

@lists = List.find(:all)

#loop through each list
@count = 0

while @count < @lists.length

  @user = User.find(@lists[@count].user_id)
  Net::POP3.start(@lists[@count].popserver, nil, @lists[@count].popuser,
@lists[@count].poppassword) do |pop|
    pop.mails.each do |email|

      @the_mail = Processing.receive(email.pop)

      # processing of the mail

      Processing.deliver(@new_mail)

      email.delete

    end
  end

  @count = @count + 1
end

The program itself was thrown together and willo be cleaned up after the
functionality is all in place.

Anyone have any ideas why I''m getting this error and what I can do
about it?

Dan Matthews
-------------- next part --------------
An HTML attachment was scrubbed...