Sin impuesto Con impuesto

Cron in PrestaShop: scheduled tasks done right

Subscriptions, Google feeds, ERP synchronisation: many things depend on a cron job. We show you how to set them up so they do not fail silently.

Jesús Meilán
Updated: 26/09/2026 131
Cron in PrestaShop: scheduled tasks done right
Share:

Many store functions are not triggered by a customer but by the clock: charging subscription renewals, regenerating the Google Shopping feed, synchronising stock with the ERP, cleaning up carts. That is what cron tasks are for.

Two ways to run them

By URL

*/15 * * * * curl -s "https://tienda.com/module/mimodulo/cron?token=XXXX" > /dev/null

Simple and works on any hosting, but the task is subject to the web server's limits (execution time, page cache, firewall).

From the command line

*/15 * * * * cd /var/www/tienda && php modules/mimodulo/cron.php >> var/logs/cron-mimodulo.log 2>&1

No web server limits and its own log. It is the preferable option when you have SSH.

Security

  • Every cron URL must carry a long, random token and check it before doing anything.
  • Never put the token in a public link or in the robots.txt.
  • If the task takes payments or sends emails, make it idempotent: running it twice must not charge twice.

Do not let them fail silently

  • Keep a log with the date, what it did and how long it took.
  • Store the date of the last successful run and show it in the module's back office.
  • Send an alert (email, Telegram, Slack) if a critical task has gone too long without running.
In copies and test environments, disable the cron jobs that take payments or send emails. A copy of the store with the real gateway keys and the renewals cron active can charge real customers.

Reasonable frequencies

TaskFrequency
Subscription renewalsOnce or several times a day
Stock synchronisationEvery 5–15 minutes
Product feedsOnce a day
Data clean-upOnce a week or once a month
Loading...
Cookie consent
Back to top