what actually happens when l do rbenv init - without shell parameter? #1473
-
so l want to use rbenv with cronjob and it always fail to execute the task then l found this blogpost and want to learn the syntax it said from the blog that l need to add path and do rbenv init like this
is rbenv is optimal to do everytime my cron job is executed or there is another approach to this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi, the If you just want automatic Ruby version switching, add For example:
|
Beta Was this translation helpful? Give feedback.
Hi, the
eval ... rbenv init
line is not meant for cronjobs or other noninteractive scripts. It's only meant to be loaded into an interactive shell.If you just want automatic Ruby version switching, add
~/.rbenv/shims
to PATH instead of~/.rbenv/bin
. Adding~/.rbenv/bin
to PATH is only useful if your script needs to call therbenv
command, which your cron job (and most other scripts) don't have to ever do. https://github.com/rbenv/rbenv#how-rbenv-hooks-into-your-shellFor example: