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!
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>
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.