What is Cron?
A Cron job (Cron as in “Chronos”, God of time) can perform a certain task in a certain interval.
Cron is a Unix/Linux program, the Windows equivalent for a Cron Job is called Windows Task Scheduler.
What does the Cron Job do?
We recommend to run a Cron job every day to keep Archimedes running smooth, for example 5AM every night.
The cron job performs a couple of tasks, like:
- deleting old log files
- refresh caches
- removing expired users
- sending invoices for subscriptions each month
- etc
Create a Cron Job on Windows
To create the Cron job:
Create a task in Task Scheduler (guide for Task Scheduler).
This task is the following:
curl [url]
You can find the url by logging in to the Archimedes admin panel:
Go to “settings” (menu), “maintenance” (tab), “Cron job” (heading)
Example:
curl http://localhost/archimedes/admin-2389dj3/cronjob.php?id=zcsamjH3tyss2uj2jh2jkhqwhjkedh2j2mmctg2gppC7N
(the exact url is different in every situation)
Create a Cron Job on Linux
In the terminal use the following command
crontab -e
then enter
0 5 * * * wget [url]
This executes the cron job at 5:00 AM every night.
You can find the url by logging in to the Archimedes admin panel:
Go to “settings” (menu), “maintenance” (tab), “Cron job” (heading)
Example:
0 5 * * * wget http://localhost/archimedes/admin-2389dj3/cronjob.php?id=zcsamjH3tyss2uj2jh2jkhqwhjkedh2j2mmctg2gppC7N
(the exact url is different in every situation)
When Cron job fails
When running a Archimides Cron job, it blocks other Cron jobs from running for security and persistence reasons.
It can happen that a Cron job fails for unexpected reasons, this will prevent other Cron jobs from running in the future.
To unblock the Cron Job:
- Open your config file located on the webserver, called “application_[xxx]” (on Windows XAMPP this is probably: c:\xampp\archimedes\config\)
- set the variable: APP_CRONJOB_ISEXECUTING to false
- Save the config file