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? |
Replies: 1 comment
|
Hi, the If you just want automatic Ruby version switching, add For example: |
Hi, the
eval ... rbenv initline 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/shimsto PATH instead of~/.rbenv/bin. Adding~/.rbenv/binto PATH is only useful if your script needs to call therbenvcommand, 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: