Email Reminders

Added by Lee Taylor over 12 years ago

Hi all,

I noted this page: http://redmine.rubyforge.org/svn/trunk/lib/tasks/reminder.rake (in order to apply sending email notifications to the necessary users assigned to the tasks).

Shall I simply be able to run this command below to initiate email reminders?

Command: rake redmine:send_reminders days=7 RAILS_ENV="production"

Thank you.

Replies (10)

RE: Email Reminders - Added by Sean Murphy over 12 years ago

Lee,
I did not get reminders daily for the command above. The reminders worked only when I ran the command, which of course isn't the point.
What I did was create a 'company_reminders' file in our redmine/lib/tasks dir and run that from our cron.
Since this wasn't as straight forward to me as possibly should have been I'll try to help you (and others) out.

1) create reminder file:
$vi /srv/www/htdocs/redmine/lib/tasks/company_reminders (or wherever you want the file located, I put ours in the same dir as the reminder.rake file)
  1. begin company_reminders file
  2. since cron doesn't have the paths set, use the full path to your rake dir (which for me was /usr/local/bin/)
  3. I specify the RAILS_ENV outside of the send_reminders rake
    /usr/local/bin/rake RAILS_ENV=production redmine:send_reminders days=7 project=2
    /usr/local/bin/rake RAILS_ENV=production redmine:send_reminders days=0 project=2
  4. put each reminder you want on a seperate line
  5. end company reminders_file
2) Add the file to your cron job list
$sudo crontab -e
  1. use sudo crontab -e instead of crontab -e to avoid any need for user/pswds
  1. begin cron file addition, this all goes on one line
    0 6 * * * cd /srv/www/htdocs/redmine/lib && /srv/www/htdocs/redmine/lib/tasks/company_reminders > /srv/www/htdocs/redmine/lib/tasks/company_reminders.log 2>&1
  1. This is the breakdown of the command in parts:
  2. {0 6 * * *} => run every day at 6:00 AM
  3. {cd /srv/www/htdocs/redmine/lib} => location of your redmine.rb rake project file !!SUPER IMPORTANT!!
  4. {&& /srv/www/htdocs/redmine/lib/tasks/company_reminders} => And now execute the lines in the company_reminders file
  5. {> /srv/www/htdocs/redmine/lib/tasks/company_reminders.log 2>&1} => overwrite/create a company_reminders.log for errors
  6. Note: I overwrite the company_reminders.log file each time, use >> to append it.
  7. Note2: This log option is not necessary

That's it. It takes cron a couple minutes (literally 1-2 minutes) to process the added entry.
If you want to test it immediately (and who doesn't) change the 0 6 * * * to * * * * * to run every minute until you see an error file or you get emails.

Good luck!

RE: Email Reminders - Added by Lee Taylor over 12 years ago

Sean,

That's great! Thanks for taking the time to get all this down for the benefit of the community.

I'll try it out soon and reply with the status of our progress.

Very Much appreciated.

RE: Email Reminders - Added by Michael Aye over 12 years ago

What's the status on this?
Is this still the only way to have email reminders?
Does this way work?

RE: Email Reminders - Added by Lee Taylor over 12 years ago

Hey Michael,

If you're updated to the latest version, check this post out

As stated, you can run this command to see available options: rake -D redmine:send_reminders

An example would look like this:
rake redmine:send_reminders days=7 RAILS_ENV="production"

Hope that helps!

Thanks,
Lee

RE: Email Reminders - Added by Lee Taylor about 12 years ago

Also just to note, be sure to add this command to run via a cron job. just wanted to make sure this was noted unless not assumed.

Thanks.

RE: Email Reminders - Added by Michael Aye about 12 years ago

In Sean's instruction is missing that the new file "company_reminders" needs to have execution permission set with "chmod u+x company_reminders", otherwise crontab won't execute it, even so the same commandline works inside a shell.

Best regards,
Michael

RE: Email Reminders - Added by Axel dV almost 12 years ago

Not bad yep. But it sends reminders on "Resolved" tasks. Why is that?
Cheers

Axel

RE: Email Reminders - Added by Axel dV almost 12 years ago

Axel dV wrote:

Not bad yep. But it sends reminders on "Resolved" tasks. Why is that?
Cheers

Axel

Don't worry about my question. Found a workaround

Other question: my reminder sends every morning at 6AM the tasks for the same day. Does it also send reminders for over-due tasks?
Cheers

RE: Email Reminders - Added by Gildo Caceres over 11 years ago

How do you make in order to avoid notifications of "Resolved" and "Closed" tasks?

RE: Email Reminders - Added by demt hu almost 10 years ago

How do you make in order to avoid notifications of "Resolved" and "Closed" tasks?

(1-10/10)