The Cron service runs every 5 minutes to ensure that background process happen in ADAM. Such processes include:
- Regular database snapshots
- Processing the messaging queue
- Recalculating of changed marks
It is important that the cron service runs regularly. ADAM will notify system administrators by way of an error message on the login page if the cron process has not run for at least 10 minutes:
Setting up the Cron Service
The following commands should be run to set up the crontab server by an authorised sudo user:
sudo crontab -l -u www-data > ~/tempcron
sudo sed -i "/adam\/cron\.php/d" ~/tempcron
echo "*/5 * * * * php /var/www/adam/cron.php > /dev/null" >> ~/tempcron
sudo crontab -u www-data ~/tempcron
In order, these commands will:
- Get a list of all existing crontab services for the user www-data, stored in a temporary file called “tempcron”.
- Remove any lines with “adam/cron.php” in them.
- Add in the command to run ADAM’s cron task evert 5 minutes. Note that this command assumes that there is only a single school running on the server who’s configuration is located in the “config.ini” file. If this is not the case, please contact us for more information!
- Load the modified cron services.
- Remove the temporary file.
You will need to set up a Scheduled Task to run every 5 minutes. This can be done as follows:
- Click on “Start” and type “Task Scheduler” to search for the Windows Task Scheduler.
- Create a new task by clicking on “Action” and then “Create Task…”.
- Name the task “ADAM Cron”
- Click on the “Change User or Group” button. In the bottom text box, type in “SYSTEM” and click on “OK”.
- Move to the “Triggers” tag and click on the “New...” button to add a new trigger.
- Change the “Settings” option to “Daily”.
- Change the start time to midnight (“00:00:00”).
- Click on the checkbox “Repeat task every” and in the dropdown list, type “5 minutes”.
- Leave all other settings as default and click on the “OK” button.
- Click on the “Actions” tag and click on the “New…” button to add a new action.
- The program/script should point to the “php.exe” executable on your computer. Search for it in Windows Explorer if required.
- In the “Add arguments” box, enter the path to the “cron.php” file within the ADAM source code.
- Click on the “OK” button. NOTE THAT YOUR VALUES WILL ALMOST CERTAINLY DIFFER FROM THE IMAGE ABOVE!
- Click on the “Settings” tab. Change the setting to “Stop the task if it runs longer than” to 1 hour.
- Click on “OK”.