TWERPLEX

Version 1.0.0 · CodeCanyon edition · PHP 8.3 or newer

Cron and queue

One cron entry drives everything that happens on a schedule. Background jobs run from the same entry, so a dedicated queue worker is optional.

The cron job

* * * * * php /path/to/twerplex/artisan schedule:run >> /dev/null 2>&1

Replace /path/to/twerplex with the folder that holds artisan. The last installer page shows the line with the real path filled in. In cPanel open Cron Jobs, choose Once Per Minute and paste the command part. If your host needs the full path to PHP, replace php with it, for example /usr/local/bin/php; the PHP used by cron must be the same major version as the web server's.

The scheduler records every run. Command → Overview warns when the cron has not run for a while, and Operations → Recovery shows the scheduler's health, the last run of each task and what is overdue.

What the scheduler does

The queue

Background jobs use the database queue by default; nothing else has to be installed. Every minute the scheduler starts a worker that drains the queue and stops, so jobs are processed within a minute of being queued. Where PHP's proc_open is available the worker runs beside the other scheduled tasks; otherwise it runs for a few seconds before them.

Busy installations can run a permanent worker instead. Start it under a process supervisor such as systemd or Supervisor:

php /path/to/twerplex/artisan queue:work database --tries=3 --timeout=40 --max-time=3600

With a permanent worker the cron entry stays as it is; the per-minute worker simply finds the queue empty.

Redis can be used for the queue and the cache by setting QUEUE_CONNECTION=redis and CACHE_STORE=redis in .env together with the REDIS_* values, then running php artisan optimize:clear and php artisan optimize.

Failed jobs

Jobs that fail after their retries are kept for 30 days. Operations → Recovery lists them with the reason and lets you retry or discard them. Nothing is retried automatically without a staff decision, except the provisioning and domain operations that have their own retry rules.

Maintenance mode

Operations → Maintenance takes the site offline for visitors while staff keep working, pauses automation (no suspensions, terminations or emails go out while a hold is on) and shows what is still in flight. Updates and restores use the same mechanism and lift it when they finish.

↑