Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/scooller/Leben-site/llms.txt

Use this file to discover all available pages before exploring further.

On a standard cPanel shared hosting environment there is no persistent process manager, so both the Laravel scheduler and the queue worker must be registered as separate cron jobs. The scheduler triggers timed tasks every minute; the queue worker processes jobs from the jobs table. Running schedule:run alone will not consume queued jobs when QUEUE_CONNECTION=database.

Required Cron Jobs

Add the two entries below in cPanel → Cron Jobs. Both run every minute (* * * * *). Adjust /home/adminmktleben/laravel to match your account’s actual home directory.

1 — Laravel Scheduler

Fires all scheduled tasks defined in the application’s console kernel.
* * * * * /usr/local/bin/php /home/adminmktleben/laravel/artisan schedule:run >> /dev/null 2>&1

2 — Queue Worker (with flock)

Processes jobs from the database queue. flock prevents multiple overlapping worker instances from starting between cron cycles.
* * * * * /usr/bin/flock -n /tmp/leben-queue.lock /usr/local/bin/php /home/adminmktleben/laravel/artisan queue:work database --queue=default --sleep=3 --tries=3 --backoff=5 --max-time=50 --stop-when-empty >> /home/adminmktleben/laravel/storage/logs/queue-worker.log 2>&1
Worker flag reference:
FlagValuePurpose
--queuedefaultProcesses the default queue
--sleep3Seconds to sleep when no jobs are waiting
--tries3Max attempts before a job is marked failed
--backoff5Seconds to wait between retry attempts
--max-time50Worker exits after 50 s (safely before next cron cycle)
--stop-when-emptyExits cleanly when the queue is drained
Do not prefix cron commands with - (a dash and a space). cPanel will reject or silently mis-parse the entry if the command line starts with a dash character.
Verify the path to flock on your server before saving the cron job. Run which flock in an SSH session — the path is usually /usr/bin/flock but may differ across hosts.

Scheduled Tasks

These are the recurring tasks registered in iLeben’s scheduler. They run automatically once the scheduler cron job is active.
Command / JobFrequencyPurpose
reservations:expireEvery minuteExpires overdue plant reservations
SyncPlantsJob (job)Every minute (runs every 5 min by default, configurable via salesforce_sync_interval_minutes setting)Syncs plant catalogue from Salesforce
model:prune (FrontendPreviewLink)DailyPrunes expired frontend preview link records
salesforce:refresh-tokenEvery 20 hours (0 */20 * * *)Refreshes OAuth token and syncs backup

Queue Configuration

iLeben uses the database queue driver on cPanel. Ensure your .env contains:
QUEUE_CONNECTION=database
Queued jobs are stored in the jobs table. Completed jobs are removed automatically; failed jobs move to the failed_jobs table after exhausting all retry attempts.

Log Rotation

The queue worker appends all output to storage/logs/queue-worker.log. Without rotation this file will grow unboundedly. Add these two cron jobs to rotate daily and keep 14 days of history. Rotate at midnight (00:00):
0 0 * * * /bin/mv /home/adminmktleben/laravel/storage/logs/queue-worker.log /home/adminmktleben/laravel/storage/logs/queue-worker-$(date +\%F).log 2>/dev/null; /usr/bin/touch /home/adminmktleben/laravel/storage/logs/queue-worker.log
Delete logs older than 14 days (00:10):
10 0 * * * /usr/bin/find /home/adminmktleben/laravel/storage/logs -name 'queue-worker-*.log' -type f -mtime +14 -delete
In cPanel’s cron editor the % character must be escaped as \%. The commands above are already escaped — do not add additional escaping.

Troubleshooting

Jobs accumulate with attempts = 0

If you query the jobs table and see rows with attempts = 0 and reserved_at = NULL that are not being processed, the queue worker cron job is not running. Verify:
  1. The worker cron entry exists in cPanel → Cron Jobs.
  2. The flock path (/usr/bin/flock) is correct for your server.
  3. The artisan path (/home/adminmktleben/laravel/artisan) matches your install location.
  4. Check storage/logs/queue-worker.log for PHP errors or permission issues.

Verifying the worker is processing

Monitor the jobs table row count and watch the log file in real time:
tail -f /home/adminmktleben/laravel/storage/logs/queue-worker.log
The count in jobs should decrease after each cron cycle when the worker is operating correctly.

Build docs developers (and LLMs) love