Project

General

Profile

MTA issue on CRON when send reminder mail

Added by Steven Wang almost 10 years ago

Hi,

I've installed redmine with Bitnami stack for months. And it works fine.

Since I want to add send_reminders option for issue due reminders.
So I create the shell script called "reminders.sh", and the content of it is:

cd /opt/bitnami/apps/redmine/htdocs
ruby bin/rake redmine:send_reminders days=3 RAILS_ENV=production

I put it on the root, and when I execute it, the reminder mail did send.
But certainly it must be run under crontab, so I add this line to crontab:

*/5 * * * * root ./reminder.sh

But the CRON log in /var/log/syslog shown:

(CRON) info (No MTA installed,discarding output)

I've been searching such issue on internet.
They said it might need MTA like postfix , cause cron didn't know how to send mail.
My question is:

Is there any way without install MTA to solve this issue?

Thanks for your kindly help!

BRs,
Steven

My version information as below:

Environment:
Redmine version 2.5.1.stable
Ruby version 1.9.3-p547 (2014-05-14) [x86_64-linux]
Rails version 3.2.17
Environment production
Database adapter Mysql2
SCM:
Subversion 1.8.8
Git 1.9.0
Filesystem
Redmine plugins:
event_notifications 2.0.0
redmine_backlogs v1.0.6
redmine_dashboard 2.2.2
redmine_knowledgebase 3.0.4
redmine_planning 0.7.6
redmine_screenshot_paste 2.1.0


Replies (11)

RE: MTA issue on CRON when send reminder mail - Added by Steven Wang almost 10 years ago

Hi:

This problem really bother me for weeks.
I've been searching on community of Bitnami and redmine.org.
But none of them mentioned this kind of issue.
I hope people who familiar with redmine email system
could just help me.
Many many thanks!

BRs,
Steven

RE: MTA issue on CRON when send reminder mail - Added by Matias Fusaro about 8 years ago

Steven Wang wrote:

Hi:

This problem really bother me for weeks.
I've been searching on community of Bitnami and redmine.org.
But none of them mentioned this kind of issue.
I hope people who familiar with redmine email system
could just help me.
Many many thanks!

BRs,
Steven

I have the same problema!!

RE: MTA issue on CRON when send reminder mail - Added by Matias Fusaro about 8 years ago

The problem arises only when running through crontab, if I run the command from the console works properly and send me the mail.
The configuration of mail have it properly.
Sorry for the translation, use google translate

RE: MTA issue on CRON when send reminder mail - Added by Pavel Potcheptsov about 8 years ago

Post exact content of your cron job file, script file and configuration.yml.
Do you have sendmail or postfix installed?

RE: MTA issue on CRON when send reminder mail - Added by Matias Fusaro about 8 years ago

The content of my script reminder.sh

#!/bin/sh
cd /opt/bitnami/apps/redmine/htdocs
bundle exec rake redmine:send_reminders days=7 RAILS_ENV="production" 

my crontab

30 7 * * * /home/bitnami/backup-bdd-redmine
#30 14 * * * "/opt/bitnami/apps/redmine/htdocs/reminder.sh" 
30 14 * * * "/home/bitnami/reminder.sh" 
#30 14 * * * /opt/bitnami/ruby/bin/ruby /opt/bitnami/apps/redmine/htdocs && bundle exec rake redmine:send_reminders days=7 RAILS_ENV="production" 
#30 14 * * * cd /opt/bitnami/apps/redmine && bundle exec rake redmine:send_reminders days=7 RAILS_ENV=production
#30 16 * * * cd /opt/bitnami/apps/redmine/htdocs; /opt/bitnami/apps/redmine/bundle exec /opt/bitnami/ruby/bin/rake -f /opt/bitnami/apps/redmine/Rakefile redmine:send_reminders days=7 RAILS_ENV="production" 

Commented lines (#) were tested without success

Clarified that the script works correctly when run.

I am using a virtual machine of Bitnami. in the same way that explains the user of the first post

thank

RE: MTA issue on CRON when send reminder mail - Added by Pavel Potcheptsov about 8 years ago

Post exact content of your cron job file, script file and configuration.yml.
Do you have sendmail or postfix installed?

Anyway you can try this trick (grabbed from my /etc/cron.d/reminder):

SHELL=/bin/bash
10 8 * * 1-6 root source "/usr/local/rvm/scripts/rvm"; cd /var/www/rm260 && /usr/local/rvm/gems/ruby-1.9.3-p327@global/bin/rake reminder:exec RAILS_ENV="production" > /dev/null 2>&1

RE: MTA issue on CRON when send reminder mail - Added by Matias Fusaro about 8 years ago

I have not installed or postfix or sendmail.
mail settings

# default configuration options for all environments
default:
  # Outgoing emails configuration (see examples above)
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      ssl: true
      address: "smtp.abitab.com.uy" 
      port: '465'
      domain: "smtp.abitab.com.uy" 
      authentication: :login
      user_name: "xxxxxxxxxxxxxxx@abitab.com.uy" 
      password: "**********" 

--------

I do not understand this line
10 8 * * 1-6 root source "/usr/local/rvm/scripts/rvm"; cd /var/www/rm260 && /usr/local/rvm/gems/ruby-1.9.3-p327@global/bin/rake reminder:exec RAILS_ENV="production" > /dev/null 2>&1

/usr/local/rvm/scripts/rvm????
cd /var/www/rm260 = location of redmine
@global/bin/rake ?????

Greetings and thanks

RE: MTA issue on CRON when send reminder mail - Added by Pavel Potcheptsov about 8 years ago

Please try this and post output of log.file

30 * * * * root cd /opt/bitnami/apps/redmine/htdocs && /opt/bitnami/ruby/bin/ruby /opt/bitnami/ruby/bin/rake -f /opt/bitnami/apps/redmine/htdocs/Rakefile redmine:send_reminders days=7 RAILS_ENV="production" >> /tmp/log.file

RE: MTA issue on CRON when send reminder mail - Added by Matias Fusaro about 8 years ago

It does not work, the log.file file is not generated. I leave the syslog log.

May 30 12:33:01 redmine CRON2996: (bitnami) CMD (root cd /opt/bitnami/apps/redmine/htdocs && /opt/bitnami/ruby/bin/ruby /opt/bitnami/ruby/bin/rake -f /opt/bitnami/apps/redmine/htdocs/Rakefile redmine:send_reminders days=7 RAILS_ENV="production" >> /home/bitnami/log.file)
May 30 12:33:01 redmine CRON2995: (CRON) info (No MTA installed, discarding output)

Thanks for the help but not working, tried in various ways but does not work

RE: MTA issue on CRON when send reminder mail - Added by Pavel Potcheptsov about 8 years ago

Ok try to change the previous command:

30 * * * * root cd /opt/bitnami/apps/redmine/htdocs && /opt/bitnami/ruby/bin/ruby /opt/bitnami/ruby/bin/rake -f /opt/bitnami/apps/redmine/htdocs/Rakefile redmine:send_reminders days=7 RAILS_ENV="production" > /tmp/log.file 2>&1

The idea here is to force cron not to email warning about absence of MTA.
You can also apt-get install sendmail to get rid of cron warning and let cron to write mail to root with details of job.
Or add MAILTO="" in your crontab file.
Or modify your script by adding
#!/bin/bash
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin

    (1-11/11)