I have install ruby by rvm (system-wide), and worked correctly via normal console and my rails program is behaving correctly with both rails runner
and apache2+passenger
.
Now in a crontab, I called rails runner foo.bar
, it gives up, carefully examine the log i see that:
/usr/bin/env: ruby: No such file or directory
Anyone knows why /usr/bin/env doesnt work in crontab?
Why? (styled as WHY?) is an American alternative hip hop and indie rock band. The band was founded in 2004 by Cincinnati rapper and singer Yoni Wolf, who had been using Why? as his stage name since 1997.
If you installed ruby via rvm, ruby probably isn't in /usr/bin. Depending on where rvm is installed:
bash -c "source /usr/local/lib/rvm" && rails runner foo.bar
You probably added a source */rvm to your bashrc that is the correct rvm loading script.
your cron isn't inheriting your environment. try echoing "$PATH" to a file to see what it's set to.
You could also just do "PATH=/usr/bin/ruby && foo.rb"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With