-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using RVM with Cron #4293
Comments
Ok, I found the following which seems to work:
Shouldn't rvm-shell be sourcing that for me? Is that the best or "most correct" way to achieve this? |
you could use |
@Wardrop I've been doing my cron like this for years:
I like doing it this way as you don't have to worry about pulling the rug out from other scheduled tasks by changing the SHELL for everything. |
|
hangs on my system :-(. I have do Ctrl-Z + kill %1 |
I have a bash script I'm calling as a cron job. This bash script calls multiple ruby scripts. I'm struggling to find the best method of configuring the appropriate ruby version to use. I want to avoid editing the bash script or ruby scripts, as these should be portable and shouldn't contain hardcoded environment-specific stuff.
Here's an example of what I'm trying to do. In this scenario, my RVM default ruby version is RVM is 2.3. My ruby script, titled
my_ruby_script.rb
below, requires ruby 2.5. How do I achieve this?/etc/cron.d/my_bash_script
/opt/project/my_bash_script.sh_
/opt/project/my_ruby_script.rb
I've tried a few things, including doing the following in my cron file, but I get "RVM is not a function ...".
I've also tried creating a .ruby-version file, and cd'ing into the directory like so, but it's not respecting what's in .ruby-version, and still uses the RVM default ruby.
None of the RVM documentation has managed to help me. All the cron-related examples it gives call a ruby script directly which is much more trivial. Any advice?
The text was updated successfully, but these errors were encountered: