Report this

What is the reason for this report?

How to set up Cron to trigger a Rake?

Posted on December 22, 2013

Hello - I have a rake task that I’d like to schedule a cron to run. My Rails 4 droplet is running Ubuntu 12.10 (Nginx + Unicorn).

Here’s what I have in crontab: SHELL=/bin/bash PATH=/sbin:/bin/usr/bin HOME=/ MAILTO=“xxx@gmail.com”

          • /bin/bash -l -c ‘source ~/.bash_profile && cd /home/rails && RAILS_ENV=production bin/rake populate:fetch_nr_songs’

I get this error /etc/profile.d/rvm.sh: line 9: ps: command not found /etc/profile.d/rvm.sh: line 10: ps: command not found /usr/local/rvm/scripts/rvm: line 96: dirname: command not found ERROR: Missing proper ‘which’ command. Make sure it is installed before using RVM!

Any fix would be much appreciated thanks



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Now I get this error message: <br>/bin/bash: //.bash_profile: No such file or directory <br>

That’s because you have HOME set to <code>/</code>. Delete that line too.

Did it have all those variables by default? Try resetting it to how it was before you edited it and using <code>crontab -e</code> to edit the cron instead.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.