Scheduled Tasks (Cron Job) Setup

Run TruCMS’s recurring maintenance reliably with one server cron job.

What the scheduler does

TruCMS has recurring housekeeping jobs that must run even when nobody is browsing the website. Instead of creating a separate cron job for every task, the server calls the TruCMS scheduler once per minute. TruCMS then decides which registered tasks are due.

If the scheduler is not running, the website still appears online, but these background jobs quietly stop. The most visible signs are pages that do not refresh after you change a provider or product, expired payments that are not cleaned up, and held stock that is never released.

Set this up once and leave it running

The same entry keeps working when TruCMS or a plugin adds another scheduled task in a future update. You never need to add a second cron job.

What TruCMS schedules

TaskHow oftenWhat it doesNeeds
Refresh pages with data-bound sectionsEvery hourRe-checks every page built from data-bound sections (providers, services, products, posts) and updates it if its data changed. A safety net next to the automatic update that happens when you edit a record.Core
Clean up unpaid booking payment attemptsEvery hourCancels booking payment attempts that were never completed and removes old cancelled ones, so held time slots return to the calendar.Booking
Renew calendar sync subscriptionsDaily at 03:20Renews the connection that lets Booking learn about changes in a provider’s linked calendar, before it expires.Booking
Expire checkout attemptsEvery 15 minutesCloses shop checkouts that were started but not finished.TruCommerce
Release held stockEvery 15 minutesReturns stock that was held for an unfinished checkout to the shelf.TruCommerce
Clean up shop dataDaily at 02:10Removes expired or draft shop records that no longer need to be kept.TruCommerce
Refresh shop cachesDaily at 02:30Rebuilds shop caches and derived product information.TruCommerce
Generate missing product image sizesDaily at 03:00Creates any product picture sizes that are missing so shop pages load quickly.TruCommerce

Tasks of a plugin appear only while that plugin is active. All times are in your server’s time zone.

Not scheduled by default

Support tickets are not closed automatically, and emails are sent as they happen, not by the scheduler. If you set up background processing for emails and notifications, that is a separate worker; see Queue & Background Jobs.

Before you create the cron job

If you are unsure about the path or the PHP executable, ask your host. Shared hosts often show both in the hosting control panel.

The cron job to add

Create one cron entry that runs every minute:

* * * * * cd /home/USERNAME/path-to-trucms && /usr/bin/php artisan schedule:run >> /dev/null 2>&1

Replace /home/USERNAME/path-to-trucms with the real TruCMS folder and, if necessary, /usr/bin/php with the PHP command-line path supplied by your host.

Do not point the command at the public folder

The command runs from the TruCMS folder, not from the website’s public document root.

cPanel

  1. Open Cron Jobs in cPanel.
  2. Choose the Once Per Minute schedule, or enter * * * * *.
  3. Paste the command above after replacing the paths with the values for your account.
  4. Save. If your account has Terminal access, test it as described below.

Plesk

  1. Open the domain’s Scheduled Tasks area.
  2. Create a task that runs a command every minute.
  3. Use the same cd … && php artisan schedule:run command with your subscription’s paths.
  4. Save the task and confirm it is enabled.

VPS or server with SSH access

Edit the cron table of the account that runs the website (crontab -e on most Linux servers) and add the same once-per-minute entry.

Check that it works

From the TruCMS folder, these two commands are useful after setup:

php artisan schedule:list
php artisan schedule:run

schedule:list shows every recurring task and when it will next run; the list should match the table above for the plugins you use. schedule:run performs the same check cron will perform, and should finish without an error. Test again after moving servers or changing the PHP version.

Troubleshooting

SymptomWhat to do
Pages do not update after I edit a provider or productThe automatic update needs no cron, but the hourly safety net does. Check the cron entry; then open the page in the Page Builder and save it once.
Time slots stay blocked after an abandoned paymentThe hourly booking clean-up is not running. Check the cron entry and the PHP path.
Cron runs but nothing happensThe PHP command-line version may differ from the web version, or the path points to the wrong folder. Run the command by hand and read the message.
schedule:list shows no tasksYou are in the wrong folder, or the application cannot start (for example a database connection problem). Check the site loads.

Uploading TruCMS · Queue & Background Jobs · Data-Bound Sections