The servicedomains Script v82

Valid for versions 82 through the latest version

Version:

82


Overview

The /usr/local/cpanel/scripts/servicedomains script allows you to 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 doesn’t create a VirtualHost entry in the /usr/local/apache/conf/httpd.conf file.

For more information about service subdomains, read our Service and Proxy Subdomains documentation.

Run the /scripts/servicedomains script

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

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

Actions

You must use one of the following actions:

Action Description
add Create DNS records for a service subdomain.
remove Remove DNS records for a service subdomain.


Options

Use the following options with this script:

Option Description Example
--user The account for which to configure the user’s domains.

If you don’t use this, the system adds or removes records for all service subdomains.
--user=john
--domain The domain to configure.

If you don’t use this 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 don’t use this, the system adds or removes DNS records for the default service subdomains.
--subdomain=webdisk
--no_replace Whether to replace any existing DNS records.

  • Always pass 0 as this option’s 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


Example

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

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

This example returns the following output:

Adding service subdomains for user john.
Note:
The options that you pass to the script determine its output.

Additional records

This script adds more DNS record entries if you enable Autodiscover and AutoConfig support. For more information about enabling them, read our Service and Proxy Subdomains documentation.

When Autodiscover and AutoConfig support is enabled, the script adds the following records:

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