Scheduled jobs
On this page
Some work is done in the background: old result links and cache files are cleared, the licence is checked, the proxy pool is kept alive, yt-dlp is kept new, updates are looked for, and you are told when something needs you. One cron job, every ten minutes, runs all of it through cron.php.
The cron line
Admin → System check shows the lines for your server in the box Cron job. Add one of them in your hosting panel (cPanel: Advanced → Cron Jobs):
- Command (the best choice). It names the command-line PHP of the same version as the website, with its full path, so the panel cannot pick an older one by mistake:
*/10 * * * * /path/to/php /home/USER/public_html/cron.php >/dev/null 2>&1
- Address, with wget, for a host whose cron cannot run PHP. The same address works in an uptime monitor:
*/10 * * * * wget -q -T 120 -O /dev/null "https://your-site/cron.php?key=YOUR-KEY" >/dev/null 2>&1
- Address, with curl: the same with curl.
In cPanel the five time fields are filled in separately: choose Once Per Ten Minutes (*/10 * * * *) and paste only what comes after them.
The key in the address is the Cron secret under Settings → Advanced. It is made at installation; when you change it, change the address in your cron job too.
Test the cron line
The button Test the cron line on System check runs the line once, the way cron would (php cron.php --check), for plain php and for the PHP the site found. Each answers Works. or Does not work. with the reason, and a badge says whether it is the command-line PHP or the CGI build, and which version. No task is run.
When the server does not let PHP start programs, the button is greyed out. Add the line anyway and look at System check again after ten minutes.
From a terminal
php /home/USER/public_html/cron.php --check
proves a line without running a task. A good answer starts with AIOD-CRON-OK and names the version, the PHP and the number of tasks. AIOD-CRON-FAIL means the database did not answer; AIOD-CRON-OLD-PHP means that PHP is too old (see below).
php cron.php history runs one task on its own (any name from the table below). Over the web the same works with cron.php?key=YOUR-KEY&check=1 and cron.php?key=YOUR-KEY&task=history. A missing or wrong key is answered with Forbidden: the key is missing or wrong.
The "php" of a hosting panel
Two things often go wrong with a plain php in a cron job, and the script deals with both:
- It is the CGI build of PHP. On many cPanel servers
phpis the build meant for the web server. Scripts that only trust the command-line build take such a run for a stranger and answer 403 Forbidden into nothing. AIO Downloader knows a cron run from a web visit either way. - It is an older PHP than the website.
cron.phpitself runs on any PHP. When the PHP of the cron line is older than 8.1, it hands the work over to the command-line PHP of the right version, whose path the site has found and written tostorage/php-cli.txt. When none is known yet, it answers AIOD-CRON-OLD-PHP … In the cron line, write the full path of a newer php instead of "php".
The site looks for that PHP whenever the tasks run over the web (the heartbeat, the address with the key, the button) and PHP may start programs, about once a week. The Command line on System check uses what it found. The surest fix is always that line, copied as it is.
When no cron job arrives: the heartbeat
With Run the scheduled tasks from page views when no cron job arrives switched on (Settings → Advanced, the same switch sits in the Cron job box on System check, on by default), the site keeps its tasks going by itself:
- when no cron job has arrived for 25 minutes and the last run is at least ten minutes old, a visitor's page asks
cron.php?beat=1a few seconds after it has loaded; - the site answers at once and then works for up to about 18 seconds, the tasks that waited longest first; what is left comes first next time;
- the visitor waits for nothing.
On a quiet site nobody opens a page, so nothing runs. A real cron job is better; an uptime monitor that opens the address with the key every ten minutes counts as one.
The tasks
| Task | How often | What it does |
|---|---|---|
| results | every run | removes stored results a day after their links expired |
| cache | every run | removes stale cache files |
| rate_limits | every run | removes old rate-limit rows |
| history | every run | removes Downloads → History rows older than History retention (days) (Settings → General, 30) |
| quotas | every run | removes daily quota rows older than three days |
| cron_log | every run | keeps seven days of the task log |
| members | every run | removes member sign-ins and tokens that ran out |
| license | every run, asks at most twice a day | re-checks the licence |
| proxies | every run, while a platform needs the pool | re-checks a few proxies; runs the free finder when it is switched on |
| ytdlp | every six hours | installs yt-dlp when it is missing and replaces it when a newer release is out |
| updates | every run, looks every three hours | tells you about a new version, installs it when updates are automatic, carries on an update under way |
| notices | every run | rings the bell for a silent cron, the licence, a nearly full disk, errors in the log, failing e-mails |
| plugins | every run | the tasks of plugins (the Contact Form cleans up, for example) |
A plugin may also add a task of its own to this list.
Status on System check
The badge of the Cron job box reads:
- Arriving: a cron job ran within the last 30 minutes.
- Running without cron: the tasks ran within the hour, but no cron job arrived in the last 30 minutes (the heartbeat or the button did the work).
- Late: nothing ran for over an hour.
- Not yet: the tasks have never run.
Run cron now at the top of System check runs every task at once. Recent task runs lists the last twelve with the task, the time, what it said and how long it took. A task that failed says ERROR there, and the full line is in storage/logs/app.log.
The dashboard warns when the cron job has not run in the last 2 hours, and the bell rings after a day without any run (The scheduled tasks are not running).