The servicedomains Script

Valid for versions 82 through the latest version

Version:

82


Last modified: January 27, 2021

Overview

The /usr/local/cpanel/scripts/servicedomains script lets you create Domain Name System (DNS) records for service subdomains. The script adds the required DNS records for the subdomains to the main domain’s records. However, it does not create a VirtualHost entry in the /usr/local/apache/conf/httpd.conf file.

Run the script

To run this script on the command line, use the following format:

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

Options

Important:

You must use the add or remove option to run this script.

Use the following options with this script:

Option Description Example
add Required.
Create DNS records for a service subdomain.
add
remove Required.
Remove DNS records for a service subdomain.
remove
--user The account for which to configure the user’s domains.

If you do not use this option, the system adds or removes records for all service subdomains.
--user=username
--domain The domain to configure.

If you do not use this option but do specify a user, the system adds or removes records for that user’s service subdomains.
--domain=example.com
--subdomain The service subdomain to configure.
Note:
You cannot add the cpanel, whm, or webmail service subdomains for addon or parked domains (aliases).
If you do not use this option, the system adds or removes DNS records for the default service subdomains.
--subdomain=webdisk
--no_replace Whether to replace any existing DNS records.
  • This option only accepts the 0 value.
  • This option only applies to Autodiscover service subdomains.

For more information about Autodiscover and service subdomains, read the Additional records section below.
--no_replace=0
--old_autodiscover_host The previously-configured autodiscover service subdomain.

For more information about Autodiscover and service subdomains, read the Additional records section below.
--old_autodiscover_host=autodiscover.example.com
--force_autodiscover_support Whether the script should run as if you enabled Autodiscover support (even if you disabled it).
  • Always pass 1 as the value for this option.
  • You must disable autodiscovery service subdomains for the domain before you remove DNS records.

For more information about Autodiscover and service subdomains, read the Additional records section below.
--force_autodiscover_support=1
--ifenabled Only run the script if service subdomains are enabled.

For more information on enabling service subdomains, read our Service and Proxy Subdomains documentation.
--ifenabled
--help Display the script’s brief help documentation. --help
--man Display the script’s full documentation. --man

Example

To add the webdisk.example.com service subdomain for the username account, run the following command:

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

This returns the following output:

Adding service subdomains for user username.
Note:

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

Additional records

This script adds the following records if you enable AutoConfig and Autodiscover support:

Record type Entry
A records
  • autoconfig
  • autodiscover
SRV and TXT records
  • _caldav._tcp
  • _caldavs._tcp
  • _carddav._tcp
  • _carddavs._tcp
SRV records _autodiscover._tcp

Additional Documentation