There are two primary cron jobs in Mantis BT; one to dispatch emails and another is an event for all plugins to hook into.
Setting Up the Email Dispatch Cron Job
The scripts/send_emails.php script is responsible for sending out emails when the configuration $g_email_send_using_cronjob is set to ON. It is recommended to run this job every 5 minutes.
5 * * * /usr/bin/php <path to mantisbt root>/scripts/send_emails.php
Replace <path to mantisbt root> with the actual path to your MantisBT installation.
ref: MantisBT Email Configuration Guide
Setting Up the Plugin Events Cron Job
The scripts/cronjob.php script was introduced to allow all plugins to hook into a single cron job event. It is recommended to run this job every hour.
0 * * * * /usr/bin/php <path to mantisbt root>/scripts/cronjob.php
Replace <path to mantisbt root> with the actual path to your MantisBT installation.
ref: MantisBT Developers Guide
Note
- You can redirect the output to a log file by appending >> /path/to/logfile.log 2>&1 to your cron job command.
- Testing: Before setting up the cron jobs on your production server, test them on a development environment to ensure they work as expected.
- Security: Ensure that the scripts are secure and that the paths to the scripts are not accessible to unauthorized users.