MIDAS Knowledge Base
How to configure your server to run Scheduled Tasks
MIDAS v4.07 introduced an automated "Scheduled Tasks" feature allowing your scheduling system to automatically send email reminders to clients in advance of their bookings taking place, or their invoices being due/overdue.
In order to use this feature, your server must first be configured to execute the "cron.pl" file within your MIDAS installation once every hour.
This article describes how to configure your server to execute the "cron.pl" file upon a recurring interval.
In this article:
- Setting up a CRON job via cPanel
- Setting up a CRON job via the command line (Linux)
- Setting up a recurring task via the Task Scheduler (Windows)
- Checking your task is running / Troubleshooting
Setting up a CRON job via cPanel1) Log in to your cPanel, and select "Cron jobs":
2) In the "Add New Cron Job" section, select "Once an hour" from the "Common Settings" drop-down:
Enter the path to the cron.pl file from your MIDAS installation in the "Command" field, and click "Add New Cron Job"
Setting up a CRON job via the command line (Linux)1) Open the "crontab" editor by executing the following from the command line:
$ sudo crontab -e
This will open the default editor and allow you to edit entries in the crontab.
2) Add the following line:
0 * * * * /public_html/midas/cron.pl
(Where "/public_html/midas/cron.pl" is the path to the cron.pl file in your MIDAS installation)
In the above line, "0 * * * *" represents when the task should execute. The first number represents minutes - in this case, on the "zero" minute, or top of the hour. (If the number was 15 instead of 0, the task would execute at 15 minutes past the hour) The other number represent hour, day, month and day of the week, respectively. * is a wildcard, meaning "every time". Therefore, "0 * * * *" means "run on the hour, every hour on every day of the week"
3) Save and exit the editor, for the changes to be applied.
Setting up a recurring task via the Task Scheduler (Windows)1) Go to Start → Control Panel → Administrative Tools → Task Scheduler (or Scheduled Tasks on earlier versions of Windows)
2) Click "Create Task":
3) In the "General" tab, give the task a name, and ensure that the task is set to run under a user account with necessary permissions to execute .pl files:
4) In the "Triggers" tab, click "New", and set the task to repeat every 1 hour:
5) In the "Accounts" tab, click "New", set the Action to "Start a program", and click the "Browse" button.
If .pl files are directly executable on your Windows Server (as is the case if using Active Perl), navigate directly to the cron.pl file in your MIDAS installation.
If .pl files are not directly executable (i.e. double clicking them in Windows doesn't execute them), navigate to your perl.exe file, and then add the path to your cron.pl file in the "Add Arguments" field:
Checking your task is running / TroubleshootingLogin to MIDAS and go to MIDAS Admin Options → Manage MIDAS → Scheduled Tasks. "Last Run" will indicate when the cron.pl file was last executed:
If you've configured your server correctly, the "Last Run" time should display a time within the past 60 minutes. If "Never", or a time that's more than 1 hour ago is shown, your server has not been correctly configured to execute the "cron.pl" file every hour.
If you are confident that the cron.pl file is being executed once an hour, yet the "Last Run" indicator within MIDAS shows otherwise, it may be because the recurring task you've set up on your server is executing the cron.pl file under a different user account and/or with restricted permissions. The cron.pl file should be executed under the same conditions (same server user account/with the same permissions) as MIDAS itself runs.
← Return to Knowledge Base