Cron doesn't send any email - Command line does
Hello All,
I'm using an ubuntu distrib to run redmine redmine_mail_reminder. Email sending is working propely when I use command line (with root user)
rake reminder:exec[test] RAILS_ENV="production" and rake reminder:exec RAILS_ENV="production" works.
But when I execute them with crontab, it doesn't work. I also use root user.
Could you guide me to the solution ?
Thanks,
Cédric
Hello @cedricbix ,
I think #3 OrbHacker may help you.
While it does no help to me since I am using docker with sameersbn/redmine image. I need to change cron command from
0 8 * * 1-5 cd /home/redmine/redmine && bundle exec rake reminder:exec RAILS_ENV="production"
to
0 8 * * 1-5 cd /home/redmine/redmine && /usr/local/bin/bundle exec rake reminder:exec RAILS_ENV="production"
Refer to Cron doesn't seem to run anything #60 for more explanation.
I am writing these here just for record.
Thanks for the information. It works now.
Resolution process on my serveur :
- Find bundle binay with command : which bundle My result : /opt/bitnami/ruby/bin/bundle
- Modify crontab (I'm logged as root) : crontab -e
- Modify the crontab like below :
# Check reminders at 06:00 every day, send emails by schedule
0 6 * * * cd /opt/bitnami/apps/redmine/htdocs/ && date >> /var/log/redmine_mail_reminder.log && /opt/bitnami/ruby/bin/bundle exec rake reminder:exec RAILS_ENV="production" >> /var/log/redmine_mail_reminder.log
# Or, Check reminders at 08:30 on work days 1-6, send emails by schedule
30 8 * * 1-6 cd /opt/bitnami/apps/redmine/htdocs/ && date >> /var/log/redmine_mail_reminder.log && /opt/bitnami/ruby/bin/bundle exec rake reminder:exec RAILS_ENV="production" >> /var/log/redmine_mail_reminder.log
- Restart cron : service cron reload
- Enjoy !