WHMS runs 11 automated scheduled tasks via Laravel's task scheduler. These tasks handle billing automation, service lifecycle management, infrastructure monitoring, and data synchronization. All tasks are defined in routes/console.php and require the Laravel scheduler cron entry:
* * * * * cd /path-to-whms && php artisan schedule:run >> /dev/null 2>&1
| Time | Command | Description |
|---|---|---|
| 01:00 | whms:generate-renewal-invoices |
Generates renewal invoices for domains (60 days before expiry), hosting accounts (17 days before due date), and recurring services. Groups items by user and due date into consolidated invoices. Prevents duplicate invoicing. |
| 02:00 | whms:process-overdue-invoices |
Marks unpaid invoices as overdue when due_date has passed. Sends payment reminders at configured intervals (default: 15, 7, 3, 1, 0, -1, -3, -7 days relative to due date). Fires InvoiceOverdue event. |
| 02:30 | whms:expire-domains |
Marks active domains as "expired" when their expiry_date has passed. |
| 03:00 | whms:suspend-overdue-services |
Suspends hosting accounts and recurring services with overdue invoices past the grace period (default: 3 days). Dispatches SuspendHostingAccount job to suspend at the server panel. |
| 03:30 | whms:process-cancellation-requests |
Processes two types of cancellation requests: immediate cancellations and end-of-billing-period cancellations (when next_due_date <= now). Dispatches appropriate provisioning jobs. |
| 04:00 | whms:terminate-expired-services |
Terminates hosting accounts and recurring services that have been suspended beyond the termination threshold (default: 30 days). Dispatches TerminateHostingAccount job. |
| 05:00 | whms:prune-expired-carts |
Deletes guest shopping carts (no user_id) older than the configured expiry period (default: 7 days). Also removes associated cart items. |
| 06:00 | whms:update-exchange-rates |
Fetches latest currency exchange rates from exchangerate-api.com and updates all active non-base currencies in the system. |
| Interval | Command | Description |
|---|---|---|
| Every 6 hours | whms:sync-domain-statuses |
Syncs all active/pending domains with their registrar APIs. Updates status, expiry_date, nameservers, auto_renew, theft_protection, and last_synced_at fields. |
| Every 6 hours | whms:sync-hosting-statuses |
Syncs all active/suspended hosting accounts with their server control panels. Updates server_status and last_synced_at fields. |
| Every 5 minutes | whms:check-server-health |
Monitors all active servers. Creates ServerHealthLog entries tracking CPU load, memory usage (%), disk usage (%), account count, and reachability status. |
| Setting Key | Default | Used By |
|---|---|---|
| automation.domain_renewal_invoice_days | 60 | generate-renewal-invoices |
| automation.hosting_renewal_invoice_days | 17 | generate-renewal-invoices |
| automation.suspension_grace_days | 3 | suspend-overdue-services |
| automation.termination_days_after_suspend | 30 | terminate-expired-services |
| automation.cart_expiry_days | 7 | prune-expired-carts |
| automation.invoice_reminder_days | 15,7,3,1,0,-1,-3,-7 | process-overdue-invoices |
| billing.invoice_due_days | 7 | generate-renewal-invoices |
The scheduled tasks enforce a consistent lifecycle for all services:
| Stage | Trigger | Command |
|---|---|---|
| 1. Invoice Generated | X days before due date | generate-renewal-invoices |
| 2. Reminders Sent | Configured intervals around due date | process-overdue-invoices |
| 3. Marked Overdue | Due date passes without payment | process-overdue-invoices |
| 4. Service Suspended | Grace period expires (default 3 days) | suspend-overdue-services |
| 5. Service Terminated | Suspension threshold (default 30 days) | terminate-expired-services |