GoAdmio Command Line: subdomain with /go/subdomain

/go/subdomain manages the subdomains of a hosting account, such as blog.example.com under example.com. It can: The subdomain name must have the hosted domain directly after its first label. For blog.example.com the parent domain is example.com. Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.

Quick start

# Create a subdomain
/go/subdomain --subdomain blog.example.com

# Delete it
/go/subdomain --subdomain blog.example.com --action delete

Options

Option Required Default Notes
--subdomain Yes — The full name, such as blog.example.com. It must be shorter than 32 characters, and its parent domain must exist in /home. Names with more than one label before the parent, such as a.b.example.com, are not supported.
--documentroot No The first label of the name (blog) The folder the subdomain serves. How it maps to a folder on disk is decided by the web server configuration commands.
--redirecturl No Empty A URL. The web server configuration commands use it for the subdomain.
--action No Create edit or delete. Anything else creates.

Any other option stops the command with Subdomain: Unknown parameter: <option>.

Examples

# Create a subdomain
/go/subdomain --subdomain blog.example.com

# Create it with its own document root
/go/subdomain --subdomain shop.example.com --documentroot shop-v2

# Create a subdomain that redirects
/go/subdomain --subdomain old.example.com --redirecturl https://example.com/new

# Edit: pass both values every time
/go/subdomain --subdomain shop.example.com --action edit --documentroot shop-v3 --redirecturl ""

# Delete
/go/subdomain --subdomain blog.example.com --action delete

Output

Outcome What you get
Created Subdomain "<name>" Created Successfully. This line is printed before the record is saved, and also when the subdomain already existed.
Edited Modifying Subdomain <name>...
Deleted Subdomain <name> has been deleted., then the output of reload. Exit code 1.
Unknown option Subdomain: Unknown parameter: <option> and exit code 1.
Name too long Invalid username <name> and exit code 1. The message says "username", but the limit applies to the whole subdomain name.
Parent domain missing Domain <domain> does not exist. and exit code 1.
A folder with that name exists in /home ubdomain <name> already exists. and exit code 1. The first letter is missing in the message.

Logging

Every run is appended to /var/log/go/subdomain.log.

See the full reference at /go/subdomain and the GoAdmio command index.

GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.

By:

Posted in:


Leave a Reply

Your email address will not be published. Required fields are marked *