Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby 1.9.3 @OSX Lion and Cron

I installed Ruby 1.9.3p125 via this guide (up to point #5): LINK

Now I have this problem: my script works wonderfully from my command line, but if I execute it from Cron it seems to use a default environment and defaults to /usr/bin/ruby instead of mine (~/.rvm/rubies/ruby-1.9.3-p125/bin/ruby). What is the best way to have executed commands - manually or via cron - produce the same results?

PS: It seems to skip processing ~/.bash_login for example, where rvm is loaded into PATH

like image 377
Poochie Avatar asked Dec 05 '25 10:12

Poochie


1 Answers

In your crontab line, you can source the .bash_login before you script is run.

source ~/.bash_login && <your original command here>

That way your script will have everything you have when you run it.

like image 93
philwhln Avatar answered Dec 08 '25 01:12

philwhln



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!