Skip to main content

Automation and Cron Tasks

WHMCS relies on a main cron task to execute all its automatic processes: billing, renewals, domain synchronisation, email sending, etc. Correct cron configuration is essential for the HostMyServers registrar module to function properly.

Configure the Main Cron Task

The WHMCS cron task must be executed every 5 minutes on your server. From your server control panel (cPanel, Plesk, or directly via crontab), add the following entry:

*/5 * * * * /usr/bin/php -q /path/to/whmcs/crons/cron.php

Replace /path/to/whmcs/ with the absolute path to your WHMCS installation.

Finding the absolute path

If you're unsure of the path, connect via SSH and run pwd from the WHMCS root directory. On a typical cPanel setup, this will often be /home/youruser/public_html/ or similar.

Via cPanel

  1. Log in to cPanel
  2. Go to Scheduled Tasks (Cron Jobs)
  3. In the Command field, enter:
    /usr/bin/php -q /home/YOUR_USER/public_html/crons/cron.php
  4. Select the frequency: Every 5 minutes
  5. Click Add Cron Job

Via SSH / crontab

crontab -e

Add the line:

*/5 * * * * /usr/bin/php -q /var/www/whmcs/crons/cron.php > /dev/null 2>&1

Domain Synchronisation Task

In addition to the main cron, WHMCS has a dedicated task for domain synchronisation. It runs automatically via the main cron, but you can also run it manually.

Manual Synchronisation

From the WHMCS administration:

UtilitiesDomain Synchronisation

This page allows you to:

  • Run a full synchronisation immediately
  • View the latest synchronisation results
  • Identify domains whose status or expiry date differs between WHMCS and HostMyServers

Automatic synchronisation triggers once a day via the main cron. This is sufficient in most cases. If you manage a large volume of domains or frequently perform operations directly from the HostMyServers client area, you can increase the frequency:

0 */6 * * * /usr/bin/php -q /var/www/whmcs/crons/cron.php --do DomainStatusSync > /dev/null 2>&1

This will run a synchronisation every 6 hours.

Automatic Renewals

WHMCS manages automatic renewals according to each domain's configuration. Here is the standard workflow:

Time before expiryWHMCS action
D-30Generate renewal invoice
D-141st client email reminder
D-72nd client email reminder
D-0Expiry (if invoice unpaid)
D+xService suspension (depending on configuration)

Automatic Renewal at HostMyServers

By default, the module does not enable automatic renewal at HostMyServers (it is WHMCS that triggers the renewal via the API). If you want domains to be automatically renewed by HostMyServers independently of WHMCS, enable the Auto-renewal option in your HostMyServers client area.

Double renewal

Avoid enabling automatic renewal both in WHMCS and in your HostMyServers client area, at the risk of billing and renewing the same domain twice.

Automatic Renewal Emails

WHMCS automatically sends reminder emails to your clients before their domains expire. These emails use the templates configured in:

SetupSystemEmail TemplatesDomains category

Templates relevant to HostMyServers domains:

TemplateTrigger
Domain Expiry NoticeReminders before expiry (D-30, D-14, D-7)
Domain Renewal SuccessfulRenewal confirmation
Domain Transfer InitiatedIncoming transfer started
Domain Transfer CompletedTransfer completed

Customise these templates to match your brand and commercial messaging. Available variables (domain name, expiry date, payment link, etc.) are listed in the WHMCS editor on hover.

Verifying the Cron is Running Correctly

To verify that the cron is running correctly:

  1. In the WHMCS administration, go to UtilitiesActivityActivity Logs
  2. Filter by type Cron
  3. Verify that recent entries are present (every 5 minutes)

If no entries appear for more than 15 minutes, the cron is not configured or not running. Check the server-side configuration and any error messages in the PHP logs.