Child pages
  • The servicedomains Script
For cPanel & WHM version 76

Skip to end of metadata
Go to start of metadata

Overview

The /usr/local/cpanel/scripts/servicedomains script allows you to create service subdomain Domain Name System (DNS) records for a cPanel, WHM, or Webmail account from the command line.

Notes:

  • In cPanel & WHM version 76, we renamed proxy subdomains to service subdomains. This name more clearly describes the subdomains’ purpose rather than a specific implementation.
  • You can still run the /usr/local/cpanel/scripts/proxydomains script.


This script adds the required DNS records for the subdomains to the main domain's records, but it does not create a VirtualHost entry in the /usr/local/apache/conf/httpd.conf file.

Important:

This script only adds or removes the DNS entries for service subdomains.

  • By default, WHM automatically creates service subdomains for new users. To prevent this, you must disable the Service subdomain creation setting in the Domains section of WHM's Tweak Settings interface (WHM >> Home >> Server Configuration >> Tweak Settings).
  • To disable service subdomains that already exist, you must override the current service subdomain. For example, redirect the cpanel.example.com subdomain to the example.com domain.

Note:

You cannot add the cpanel, whm, or webmail service subdomains for addon or parked domains (aliases). You can only add cpcontacts, cpcalendar, and webdisk service subomains to addon and parked domains (aliases).

Run the /scripts/servicedomains script

To run the /usr/local/cpanel/scripts/servicedomains script from the command line as the root user, use the following format:

/usr/local/cpanel/scripts/servicedomains [action] [options]

Actions

You can use either of the following actions:

ActionDescription
addCreate a service subdomain.
remove

Remove a service subdomain.

Options

Notes:

  • If you do not specify a user, this script attempts to configure the DNS records for every service subdomain on every cPanel account on the server.
  • If you specify a user but you do not specify a domain, this script attempts to configure the DNS records for every service subdomain on the user's account.

The following table lists the options that you can pass with this script:

Option
Description
Example
--user

The account for which to configure the user's domains.

john
--domain

The domains to configure.

example.com
--subdomain

The service subdomain that you wish to configure.

Note:

If you do not specify a subdomain, the script adds or removes DNS records for the following subdomains:

  • cpanel.example.com
  • whm.example.com
  • webmail.example.com
  • cpcalendars.example.com
  • cpcontacts.example.com
  • webdisk.example.com

webdisk
--no_replace

Whether to allow the replacement of existing records.

Notes:

  • Always pass 0 as this option's value.
  • Only use this option to change Autodiscover hosts.

0
--old_autodiscover_host

The Autodiscover host that you previously configured.

autodiscover.example.com
--force_autodiscover_support
Whether the script should function as though you enabled Autodiscover support, even if you disabled it.

Notes:

  • Always pass 1 as the value for this option.
  • Only use this option to remove the domain's Autodiscovery service subdomains after you disable its support.
1

--ifenabled

Only perform the operation if service subdomains are enabled.

(none)

Example

For example, to add the service subdomain webdisk.example.com for the cPanel user john, run the following command:

/usr/local/cpanel/scripts/servicedomains add --user=john --subdomain=webdisk --no_replace=0 --force_autodiscover_support=1 --ifenabled

The output resembles the following example:

Adding service subdomains for user john.

Note:

The options that you pass to the command determine its output.

Additional records

The /usr/local/cpanel/scripts/servicedomains script adds additional entries to the DNS records if you enable the Thunderbird and Outlook autodiscover and autoconfig support (enables service subdomain and SRV record creation) setting to in the Domains section of WHM's Tweak Settings interface (WHM >> Home >> Server Configuration >> Tweak Settings). When you enable this setting, this script also adds the following entries:

Record typeEntry
A records
  • autoconfig
  • autodiscover
SRV and TXT records
  • _caldav._tcp
  • _caldavs._tcp
  • _carddav._tcp
  • _carddavs._tcp
SRV records

_autodiscover._tcp

Additional documentation