dimanche 5 juillet 2015

EC2 AMI - Cron jobs not running

I've got a Rails 3 application and there are a couple of jobs I need to run every minute. I've installed cron jobs several times, but never using AWS.

I basically executed crontab -e and wrote the following line:

* * * * * * * * * * cd /var/www/myweb/current; bundle exec rake myweb:send_emails RAILS_ENV=production

I even see the following info at the cron log, but the task is not executed:

Jul  5 21:42:01 ip-172-31-7-105 CROND[29890]: (ec2-user) CMD (cd /var/www/myweb/current; bundle exec rake myweb:send_emails RAILS_ENV=production)
Jul  5 21:42:01 ip-172-31-7-105 CROND[29891]: (root) CMD (cd /var/www/myweb/current; bundle exec rake myweb:send_emails RAILS_ENV=production)

Just for the record, when I manually run that command, the rake task works fine.

What's weird is that I added a job to the crontab file, and it worked fine:

* * * * * date >> /tmp/somefile

Not I don't know whether there's a permission issue or it's another problem, but the thing is I can't get it to work.

Please, help.

Thanks.

Aucun commentaire:

Enregistrer un commentaire