Last active
February 13, 2016 05:20
-
-
Save cre-o/4535005 to your computer and use it in GitHub Desktop.
Whenever "/usr/bin/env: ruby: No such file or directory" fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> Tested on ubuntu 12.04 if rvm installed for single user | |
$ echo $PATH # Since cron doesn't have user's local environment, we need to specify it | |
$ echo $GEM_PATH # Copy this output to | |
# Modify schedule.rb with your new PATH's | |
# It should be like this one (add it to the top) | |
env :PATH, '/home/home_user/.rvm/gems/ruby-1.9.3-head/bin:/home/home_user/.rvm/gems/ruby-1.9.3-head@global/bin:/home/home_user/.rvm/rubies/ruby-1.9.3-head/bin:/home/home_user/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/home_user/.rvm/bin' | |
env :GEM_PATH, '/home/home_user/.rvm/gems/ruby-1.9.3-head@gemset:/home/home_user/.rvm/gems/ruby-1.9.3-head@global' | |
# Now update you crontab file | |
$ bundle exec whenever -s "environment=production" --update | |
$ crontab -l # At the top, you will see PATH and GEM_PATH | |
# You've done |
Thanks for sharing! it worked!
please add also example for rbenv
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Perfect!! Thanks for sharing!