1. Overview

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

2. Daily Tasks

TimeCommandDescription
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.

3. Frequent Tasks

IntervalCommandDescription
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.

4. Configurable Settings

Setting KeyDefaultUsed By
automation.domain_renewal_invoice_days60generate-renewal-invoices
automation.hosting_renewal_invoice_days17generate-renewal-invoices
automation.suspension_grace_days3suspend-overdue-services
automation.termination_days_after_suspend30terminate-expired-services
automation.cart_expiry_days7prune-expired-carts
automation.invoice_reminder_days15,7,3,1,0,-1,-3,-7process-overdue-invoices
billing.invoice_due_days7generate-renewal-invoices

5. Service Lifecycle Flow

The scheduled tasks enforce a consistent lifecycle for all services:

StageTriggerCommand
1. Invoice GeneratedX days before due dategenerate-renewal-invoices
2. Reminders SentConfigured intervals around due dateprocess-overdue-invoices
3. Marked OverdueDue date passes without paymentprocess-overdue-invoices
4. Service SuspendedGrace period expires (default 3 days)suspend-overdue-services
5. Service TerminatedSuspension threshold (default 30 days)terminate-expired-services