Customized cron path

software development

#1

I have a custom gem source installed in ~/.gems. My ~/.bashrc looks like:

export GEM_HOME="$HOME/.gems"
export GEM_PATH="$GEM_HOME:/usr/lib/ruby/gems/1.8"
export PATH="$HOME/.gems/bin:$PATH"

My ~/.gemrc looks like:

gemhome: /home/bjhess/.gems
gempath:

  • /home/bjhess/.gems
  • /usr/lib/ruby/gems/1.8

So. I can run ruby jobs with special “requires” from my local gems fine via the command-line. However, when shoving the command into a recurring cron task, I get “no such file to load” errors:

/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require': no such file to load -- flickr_fu (LoadError) from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
from /home/…/…/scripts/slurp_flickr.rb:2

And if I try to call a command directly provided by a local gem (say, “staticmatic”), I get:

/bin/sh: line 1: staticmatic: command not found

What paths do I need to update to make these custom gems available from cron? I’ve scoured the 'net and the cron wiki for answers, but I can’t fine 'em!

TIA,

Barry


#2

Barry,

Did you ever find a solution to this problem? I’m having the same issue and was wondering if you have found a fix.

Thanks,
Bobby


#3

Yes, I did, eventually with some help from DH.

Ended up having to put the entire gempath in front of the command. Ala:

*/15 * * * * export GEM_HOME="$HOME/.gems";export GEM_PATH="$GEM_HOME:/usr/lib/ruby/gems/1.8";export PATH="$HOME/.gems/bin:$PATH";bash /home/bjhess/website.com/scripts/update.sh