I have a cron job to run a Ruby script, which runs fine on the command line (from user "user"), but the cron fails because it cannot find a ruby gem TMail. I manually installed the tmail gem to my ~/.gems/ dir, pointed to by my ~/.bashrc script, as suggested by Nate.
When invoked manually from the shell (on deadpool server)
./home/user/site.com/appdir/testbalances.sh
works fine, but from the CRONtab web-interface (same command), I get a log mail:
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
gem_original_require': no such file to load -- tmail (LoadError) from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
require' from afschriftmonitor/statement_monitor.rb:7
Lines 6 and 7 of the file afschriftmonitor/statement_monitor.rb:7 are
require 'rubygems' require 'tmail'
It seems that CRON is running from another server, or it is ignoring the ~/.bashrc file? How can I fix this? It seems to be a Dreamhost hosting specific issue, because the script runs fine locally on my Mac and - as said - fine from my shell account on Dreamhost. I am puzzled.