This question already has an answer here:
I have cron running for rails application on EC2 instance, but it fails with error -
/bin/bash: bundle: command not found
if I run bundle command with ubuntu user or sudo user that works. I have added cron using crontab -e command.
Some Troubleshooting I did (displays same result with sudo as well) -
> which ruby /usr/local/bin/ruby > which bundle /usr/local/bin/bundle
But if add these command as which ruby and which bundle in crontab and output it over logs, it shows -
Cron has -
* * * * * /bin/bash -l -c 'which ruby >> /home/ubuntu/logs/cron.log 2>&1' * * * * * /bin/bash -l -c 'which bundle >> /home/ubuntu/logs/cron.log 2>&1'
/usr/bin/ruby /bin/bash: bundle: command not found
so basically my cron is taking wrong ruby from system, what should I do to correct that ? I want to take ruby from my /usr/local/bin/ruby and then it can find bundle as well.