title: Requiring a Ruby Gem in Ruby Script breaks Cron Job Execution
body: <p>I'm trying to run a cron job using Gems. I've installed ruby via RVM and when I require a gem it breaks the cron job. I've tried requiring two totally different gems, PG / Pry, and when I require either, the cronjob doesn't complete. Here is the "testing code" that works fine:</p>
  
  <pre><code>open('/home/log.log', 'a') do |f|
    f.puts Time.now.to_s
  end
  </code></pre>
  
  <p>Here is how I setup the cronjob:</p>
  
  <pre><code>* * * * * /usr/local/rvm/rubies/ruby-2.0.0-p247/bin/ruby /home/test1.rb
  </code></pre>
  
  <p>I can see new output every minute. And when I add a require gem line at the top, it then breaks, but only when run through cron:</p>
  
  <pre><code>require 'pg'
  
  open('/home/log.log', 'a') do |f|
    f.puts Time.now.to_s
  end
  </code></pre>
  
  <p>The cronjob runs (I can see it execute in the sys log), but never completes (no output ever makes it into the text file). I've tried this on two separate servers one Debian, one CentOS, and both have the same issue. Oddly enough this only affects the cron job, if I run the same ruby file from console: /home/test1.rb it will work just fine. </p>
  
  <p>Any help would be great. </p>