How to create reminders and alerts in Redmine

Redmine Reminders & Alerts

When managing many tasks, often hundreds of them in a medium or large organization, it is difficult to be aware of what is happening at all times. It is especially relevant to control tasks with upcoming expiration, in order to guarantee their fulfillment.

In this post we will see how we can automatically create a series of email reminders that will notify users of tasks that have expired or are about to expire.

REDMINE ALERTS
Although in the Redmine configuration panel we do not have any functionality to launch reminders to users, we can create them in a relatively simple way.

What reminders can we create in Redmine

Redmine allows us to create reminders of tasks that are due or that are going to be due in a certain number of days. The parameters we can play with are the following:

  • days : the reminder will be fired X number of days before the task is due
  • trackers : we can schedule reminders for all types of tasks or only for certain types
  • projects : reminders for tasks of all projects or only those indicated
  • users : we can send reminders to all users or only to certain users
  • version : name of the version to which the tasks are assigned

How to create reminders in Redmine

As we have already said, we do not have an area in the Redmine administration panel where we can configure these alerts. We will have to access the server where Redmine is hosted to include a small schedule. It's not difficult, but you have to be familiar with the Linux command line. Here I explain step by step how to create the reminders:

Create a reminders.sh file

The first thing we have to do is create a file that we will later invoke to launch a task on the server that generates the reminders.

To create the file you can open any text editor such as Notepad or Sublime Text 3. Include the following code in the editor:

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

Save it and name it “reminders.sh”, for example.

You may need to make (or want to make) the following changes to the code above:

  • you will have to adapt the path to which the bundle exec command should call to the path where your Redmine application is actually located (that is, change /opt/bitnami/apps/redmine/htdocs , to your path), since most likely it will not be the same as I indicate here,
  • in the bundle exec command is where you can include the different parameters that you can modify. For example: if you want to generate reminders for
    • the tasks of type “Support” (id = 1) *
    • of the project “Customer service” (id = customer-service)
    • for John Doe users (id = 3) *
    • released 4 days before expiration

* remember that to see the id of a type of task or a user, you must go to the administration panel> list of users (or types of tasks) and when you hover over the name of the task type or user, you will see in the lower frame of the browser a URL of this type: https://myredmine.com/users/3/edit. That “3” is the user id that you must indicate in the command.

Then the code that you will have to include in the reminders.sh file will be this:

#!/bin/bash
cd /opt/bitnami/apps/redmine/htdocs
sudo bundle exec rake redmine:send_reminders days=4 trackers="1" users="3" projects="customer-service" RAILS_ENV="production" 

Upload the file to the server

Connect by SSH to the server and save the file in a folder that is outside the root folder of Redmine, for example “/home/bitnami/. That way, if you update Redmine, this file will not be lost and it will continue to do its job.

Launch the command manually

Well, now we have created the reminders.sh file so that we can then periodically invoke it from the cron job (task scheduled on the server) that I describe below. But actually the reminder command can be launched at any time on the server. You can try it like this:

  • go to the root directory of Redmine (it must be the same as the one indicated in the reminders.sh file)
  • launch the command manually:
sudo bundle exec rake redmine:send_reminders days=4 trackers="1" users="3" projects="atencion-cliente" RAILS_ENV="production"

In this moment the reminders will be sent to users, in this case, only to the user with id = 3.

However, launching the command manually is not practical on a day-to-day basis. To do this, we can program an automated task ( cron job ), which launches the command unattended for us.

Create a cron job (scheduled task)

To create a cron job on the server, we reconnect to the server, but this time with a “root” user, if the user with whom we have previously connected to the server was not “root”.

sudo crontab -e

Next, we go down with the cursor to an area where we can write and we indicate the following code:

0 8 * * * /bin/bash /home/bitnami/reminders.sh > /home/bitnami/cron.txt 2>&1

The above code means that the script will be launched every day at 9 in the morning (in Spain, the time zone is UTC + 1). A file called cron.txt will be created in the /home/bitnami folder where the result of the cron job will be saved.

To see the date and time of your server, you can launch the command “date”.

If you only wanted the cron job to run on weekdays, then you could change the cron job to something like this:

0 8 * * 1,2,3,4,5 /bin/bash /home/bitnami/reminders.sh > /home/bitnami/cron.txt 2>&1

Once you have entered this code in the crontab, press Crtl + O to save and Ctrl + X to exit the crontab.

You have it ready! Now every day, the reminder will be generated, just as you have programmed it.

If you are not sure how to use the different parameters of a cron job, I recommend Crontab Guru , there you can easily generate your cron job.

Has this post been useful to you? Share it on social networks. Thanks a lot.

(Note: more info in Redmine website)

About The Author

2 thoughts on “How to create reminders and alerts in Redmine”

    1. Hi, Osmair. Very likely the command is not being run in your Redmine’s main directory. In my example, main directory is “/opt/bitnami/apps/redmine/htdocs”, but you may need to change this accordingly.

Leave a Comment

Your email address will not be published. Required fields are marked *