Skip to content
A
For administrators
Running the administration — content, users, e-shop, invoicing and settings
System / Task scheduler (cron)

Task scheduler (cron)#

A website does a lot on its own in the background: it sends e-mails from the queue, cleans up old records, generates sitemaps, watches the deadlines of orders and complaints, and warns about advert expiry. For that, someone has to start these jobs at the right time. That is the job of the scheduler: you enter one single address at your hosting, and the scheduler works out by itself which job is due.

The settings are under Nastavení → Cron (settings → Cron; the Nastavení link at the very bottom of the left column, see Settings).

Connecting it at the hosting (once)#

At your hosting — for example in ISPConfig under Cron jobs — create one job that runs every 5 minutes and opens the scheduler's address:

https://your-site.com/cron/system/scheduler/run?token=YOUR_TOKEN

In ISPConfig fill in the fields like this:

Field Value
Minutes */5
Hours, Days of month, Months, Days of week *
Command curl -s "https://your-site.com/cron/system/scheduler/run?token=YOUR_TOKEN" > /dev/null

The address your hosting should call is printed at the top of the Nastavení → Cron screen (the token is not shown there for security reasons; a … stands in its place).

One address is all you need

You do not have to enter any further jobs at the hosting, not even when new ones are added later. New jobs appear in the list by themselves. If your hosting only allows calls less often (say every 15 minutes) the scheduler still works — jobs just start with a matching delay.

Where to find and how to change the token#

The token is a secret string the jobs prove themselves with (without it the site starts nothing). Find it under Nastavení → Nastavení webu (site settings), section Cron. After you change it, update the address at the hosting too, otherwise the scheduler is turned away. Never publish the token.

The list of jobs#

Jobs are grouped by module (System, Classifieds, Blog, E-shop…). Only jobs of modules that are switched on for the site are shown — a site without Classifieds neither shows nor runs classifieds jobs. If you switch a module on later, its jobs appear by themselves with their default settings. Jobs of the System module are always there.

For each job you see:

Column What it means
Úloha (job) a short description; its address underneath. The odchozí (outbound) badge is explained below
Frekvence (frequency) how often the job runs (e.g. "every 15 min", "daily at 03:30", "manual only")
Zapnuto (enabled) the button switches the job on or off; a disabled job is not scheduled
Poslední běh (last run) when it last ran and how (ok, error, skipped) + a shortened response
Akce (actions) Upravit (edit the frequency) and Spustit teď (run now)

Changing the frequency#

Click Upravit next to a job. You pick the frequency from simple options — no cron "asterisks" to learn:

Type What you enter
every N minutes a number of minutes (1–1440)
daily a time like 03:30
weekly a day of the week and a time
monthly a day of the month (1–31) and a time; in a shorter month the last day is used
manual only the job never starts by itself, only with Spustit teď

Times follow the time zone of the site. A job that missed its time because of an outage runs once after things recover (not once per missed term).

Outbound jobs#

A job is outbound when it has an effect outside the site: it sends e-mails or SMS, issues documents, deletes or anonymises user data or calls payment gateways. Examples: sending the e-mail queue, advert expiry warnings, watchdogs, issuing invoices, cancelling unpaid orders, anonymising deleted accounts.

Outbound jobs start switched off

When an outbound job first appears it is switched off. You switch it on deliberately, once the site is really live. That way nothing is sent by mistake from a test or development site. Other jobs (cleanup, sitemaps, recounts) switch on by themselves.

Run now#

Spustit teď runs the job immediately, outside the schedule — exactly as if the scheduler had called it. You see the result in the message at the top (ok / error / already running) and in the Poslední běh column. For an outbound job it asks for confirmation first, because it sends the e-mails or issues the documents for real. The button also works for a disabled job.

What if a job fails?

A job that ends with an error or does not finish gets the error state, and the scheduler tries it again only at its next term according to its frequency (not every 5 minutes over and over). You can retry at once with Spustit teď.

A job that continues (search reindex)#

A full search reindex (the Full search reindex jobs for adverts, company profiles and articles) cannot be finished in one call on larger sites, so it runs in parts. Spustit teď may then answer with the skipped state and the reason "reindex continues" — this is not an error: the work is in progress and the scheduler finishes it by itself on the following calls. It is done when the job reports a result instead of "skipped". The new search is switched on the site only after the last part; while the reindex is running, the old one is used.

Leave the reindex to the scheduler

Do not click Spustit teď over and over. It is enough for the scheduler to run every 5 minutes — it chains the parts by itself.

Failing item#

Many jobs process a queue of items — order and complaint expiry, documents from payments and catching up on documents, the invoice schedule, expiry warnings for adverts and companies. When one item cannot be processed, it does not block the others: the scheduler skips it and tries it again with growing delays — after 1 minute, 5 minutes, 30 minutes, 2 hours and then once every 24 hours. Healthy items go on normally in the meantime.

After five failed attempts in a row, administrators get the notification Cron job keeps failing linking to Nastavení → Cron. One notification is created per queue, not per item. Email addresses in the error text (for example when sending mail fails) are masked. An item that keeps failing has to be checked by hand (a missing detail, an unavailable service, a wrongly configured seller…). As soon as the item is processed, the failure record disappears and the notification is deleted by itself at the next clean-up of orphaned notifications.

Clean-up jobs#

Jobs that delete old records usually run once a day. Three of them have a configurable retention period:

Job What it deletes Where to set it Default
Clean old read admin notifications read notifications; unread ones stay Nastavení → Nastavení webu, the Cron section: Keep read notifications (days) 90 days
Watchdog: queue clean-up (adverts, company directory) sent and cancelled entries of the watchdog e-mail queue; pending entries are not deleted Inzerce → Nastavení / Katalog firem → Nastavení, the Hlídací psi tab: Delete processed queue after (days) 90 days
Clean payment gateway communication older records of the gateway communication tab of payments; payments and transactions stay Nastavení → Nastavení webu, the Cron section: Keep payment gateway communication (days) 365 days

All three jobs are ordinary (not outbound), so they switch on by themselves.

Load jobs#

Načíst úlohy adds to the list the jobs that are not there yet. Normally the scheduler does this by itself on every call; the button mainly helps on a fresh installation, before the scheduler has been called for the first time, or after a site update.

The scheduler is not being called — what to do#

The top of the screen shows the state: "The scheduler was last called N min ago". When it is yellow (has not been called for N min or has never been called), your hosting does not start the scheduler. Check:

  1. Is the job entered at the hosting and does it run every 5 minutes? In ISPConfig check that it is enabled and the address has no typo.
  2. Does the token match? A wrong or empty token returns error 403 and no jobs run. Compare the token in the address with the one in Nastavení webu → Cron.
  3. Does the address answer? Open it in a browser. You should get a short reply with "status":"ok" and the number of jobs started.
  4. Does the hosting forbid calling its own address? The scheduler calls the individual jobs on the site's address. If such a call is blocked at the hosting, jobs end in the error state — ask the hosting support to allow it, or enter the jobs one by one (see below).
  5. Is the module switched on? Jobs of a disabled module are neither shown nor run.

The existing single addresses keep working

If you have jobs entered at the hosting one by one (/cron/…?token=…) you need not change anything. If you call a job from outside, switch it off in the scheduler so it does not run twice.

What the scheduler does not do#

  • it does not run jobs in parallel — one after another, and one call lasts about 45 seconds at most; what does not fit is taken by the next call;
  • it writes nothing into the server configuration — you enter the address at the hosting once yourself;
  • it does not use */5 * * * * expressions — the frequency is picked from simple options.

Cookie settings