Running cron job with custom gem lib on dreamhost


Installed parse-ruby-client gem on dreamhost VPS.

Ruby script runs OK in console mode (use logged in)

Crontab jobs doesn’t work, complains ‘parse-ruby-client’ not found.


gem installed in user ~/.gem folder, not searchable by system process like crontab.


Add those line into ~/.bash_profile
export GEM_HOME="$HOME/.gems"
export GEM_PATH="/usr/ruby/ruby/gems/1.8:$GEM_HOME"

Add this to ~/.bashrc
if [ -f ~/.bash_profile ]; then
.  ~/.bash_profile

Those two should be good enough, but just in case. Add this before your shell.
. ~/.bashrc
/urs/bin/ruby $HOME/my_ruby_script.rb


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s