Our Masto instance is still getting "/usr/bin/env: ‘ruby2.3’: No such file or directory" when trying to-be-crontabbed commands from the production guide such as "RAILS_ENV=production bundle exec rake mastodon:media:clear" as the mastodon user.

Ruby 2.3.1 is installed and any other command seems to use it just fine.

Help!

@HedgeMage Try this command:

$ which ruby2.3

And see if that comes up with a location that's in your env

@munin No, I have Ruby 2.3.1 which may be the confusion if someone hardcoded the ruby2.3 string instead of some sane alternative.

I'm not sure where to dig in to debug it, though.

@HedgeMage Well, you could always use the sysadmin 'brute force and ignorance' solution, and

$ ln -s ruby2.3.1 ruby2.3

;-)

@HedgeMage @munin did you run that "which ruby2.3" command on the CLI and it returned an error? If so, that's your problem and the symlink solution proposed by @munin should work, it just has to be made in a directory that's in the PATH for the user the cron job runs as. Not sure if I made sense, let me know!
@hisham_hm @munin After further investigation, it looks like even after feeding the command the full rbenv bundler path, halfway through some script it tries to use the system one. Ugh.
@HedgeMage i think that section of the guide suggests that some people will need the full path to bundle in the rbenv, you might be running a sys wide bundle instead
@ryan @HedgeMage Yeah, this would be my first guess to. For the record here is what one of my crontab entries looks like: `(cd /home/mastodon/live && RAILS_ENV=production /home/mastodon/.rbenv/shims/bundle exec rake mastodon:feeds:clear)`
@ryan Thanks, but I already tried it with the rbenv bundle path explicitly stated AND double-checked that it's in that user's $PATH :(
@HedgeMage sorry, good luck!
@ryan No need to be sorry, I appreciate all attempts at help!
@HedgeMage @ryan cron jobs don't source the user's .profile, which is a common source of problems.
@HedgeMage Cron may be running /bin/sh which may not be loading .bashrc, or rbenv init may be in .bash_profile. Make sure rbenv init happens in .bashrc, add "source ~/.bashrc" to .bash_profile, and add ". /home/mastodon/.bashrc; " to the beginning of each command in the crontab (assuming you followed the production guide and have a Serbian or ubuntu server)
@superbranch I tested from the CLI directly to ensure that cron wasn't doing anything weird...it's not working there either.

@HedgeMage Here's a whole line:
6 * * * * . /home/mastodon/.bashrc; cd $HOME/live; $HOME/.rbenv/shims/bundle exec rake mastodon:media:clear > $HOME/log/media-clear.log

$HOME must be set. Must be in $HOME/live, not $HOME. Call the bundle in $HOME/.rbenv/shims. Does that help?

@superbranch That would reproduce what I already tried manually from the command line and is tossing the same error. :( Thanks, though.
@HedgeMage For completeness, I'm using debian jessie and this is my .bashrc
export HOME=/home/mastodon
export PATH="$HOME/.rbenv/bin:$PATH"
export RAILS_ENV=production
eval "$(rbenv init -)"
@superbranch Mind telling me what commit you were at when you installed Mastodon?
@HedgeMage I cloned the repo at 0200 GMT on Thursday. Not sure how to find the precise commit.
@HedgeMage Oh, did you try: rbenv global 2.3.1
@HedgeMage it's not a ruby issue it's an env issue. 'which ruby2.3' probably isn't going to get you anything.
@trelane It didn't, and I'm still fighting with it. I'd like to get this fixed so we don't get delivery delays on FHE from not having run related jobs. Any suggestions? Or ping me on IRC for faster comms?