Cron Job Setup

⌘K
  1. Home
  2. Docs
  3. Botmerze – AI Support &#0...
  4. Instruction
  5. Cron Job Setup

Cron Job Setup

BotMerze’s App\Console\Kernel registers the following scheduled commands. They all run via the single schedule:run cron entry — you do not add them individually.

Command Frequency Purpose
subscription:process-expiry-notifications Daily at 02:00 Email customers whose subscription is expiring
woocommerce:sync --type=products Every 6 hours Reconcile products missed by webhooks
woocommerce:sync --type=orders --days=1 Every 2 hours Refresh orders for chatbot lookups
woocommerce:sync --type=categories Daily at 03:00 Sync category tree
woocommerce:cleanup --days=30 Weekly (Sun 04:00) Prune old sync/webhook logs
shopify:refresh-tokens Every 30 minutes Refresh expiring Shopify access tokens

cPanel / shared hosting cron

Add one entry — the scheduler dispatches everything:

* * * * * cd /home/<user>/public_html/core && php artisan schedule:run >> /dev/null 2>&1

If you cannot run Supervisor on shared hosting, fall back to a per-minute “tick” worker for each queue:

# AI chat (highest priority)
* * * * * cd /home/<user>/public_html/core && php artisan queue:work --queue=ai_chat_processing --stop-when-empty --max-time=55 >> /dev/null 2>&1

# Default (embeddings, mail, webhooks)
* * * * * cd /home/<user>/public_html/core && php artisan queue:work --queue=default --stop-when-empty --max-time=55 >> /dev/null 2>&1

# Commerce sync (Woo + Shopify + Generic API) — combined
* * * * * cd /home/<user>/public_html/core && php artisan queue:work --queue=woocommerce,shopify,generic-api --stop-when-empty --max-time=55 >> /dev/null 2>&1

⚠️ Cron-tick workers are a fallback. Real-time chat will feel sluggish (up to 60 s lag). Move to a VPS with Supervisor as soon as traffic grows.

VPS (sudo crontab -e -u www-data)

# Laravel scheduler — required (drives all scheduled commands above)
* * * * * cd /home/<domain>/public_html/core && php artisan schedule:run >> /dev/null 2>&1

# Daily worker recycle at 04:00 (Supervisor will respawn them)
0 4 * * * cd /home/<domain>/public_html/core && php artisan queue:restart >> /dev/null 2>&1

# Optional: weekly horizon snapshot if you enable Horizon
# 0 5 * * 0 cd /home/<domain>/public_html/core && php artisan horizon:snapshot >> /dev/null 2>&1

Verify the scheduler

cd /home/<domain>/public_html/core
php artisan schedule:list      # show every scheduled task with next run time
php artisan schedule:test      # interactively run any task to confirm it works

✅ The scheduler is mandatory — without it WooCommerce sync, Shopify token refresh, subscription expiries will not run.

Was this article helpful to you? No Yes

How can we help?