jcppkkk / redmine_mail_reminder

Plugin for Redmine to create different role based reminders for project(s)
52 stars 32 forks source link

Cron doesn't send any email - Command line does #104

Open cedricbix opened 6 years ago

cedricbix commented 6 years ago

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

drakosu commented 6 years ago

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.

cedricbix commented 6 years ago

Thanks for the information. It works now.

Resolution process on my serveur :

# 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