Report this

What is the reason for this report?

Can't get Cron to work

Posted on January 2, 2014
bora

By bora

Hi guys, I’m having an issue with Cron to work.This is what I have in the crontab, that’s supposed to run every 5 minutes on Thursday:

SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin */5 * * * 4 root cd /home/rails/jukely-web && rails runner -e production ‘Pinger.send_test_sms’

But it’s not running. If I execute cd /home/rails/jukely-web && rails runner -e production ‘Pinger.send_test_sms’ from the console it runs fine.

Am I missing something in the syntax or config I wonder. I read the docs and checked the other questions but no dice.

Thanks, Bora



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.

In that case, you don’t need the “root”. This should work: <br><pre>SHELL=/bin/sh <br>PATH=/usr/local/rvm/gems/ruby-1.9.3-p448/bin/rails:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin <br>* * * * * cd /home/rails/jukely-web && rails runner -e production ‘Pinger.send_test_sms’ </pre>

Yeah I tried removing root before and now again and it didn’t help. I’m happy to give you access to the droplet if you’d like to take a look. Thanks Kamal! <br> <br>Bora

Try creating a file with this as its contents: <br><pre>#!/bin/bash <br>PATH=/usr/local/rvm/gems/ruby-1.9.3-p448/bin/rails:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin <br>cd /home/rails/jukely-web <br>rails runner -e production ‘Pinger.send_test_sms’ </pre> <br>and editing your crontab file to look like this: <br><pre>* * * * * bash /path/to/file</pre>

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.