Submitted by yngens on Sun, 08/13/2017 - 18:43
Currently we have to do something like this:
partial="$(echo $dom | cut -c1-30)"
disabled="$(virtualmin list-domains --domain $dom --disabled | grep $partial)"
if [ ! -z "$disabled" ]; then
echo "Disabled"
fi
because the virtualmin list-domains --domain $dom --disabled
seems to output only partially cut (30 symbols) domain name.
However, I believe such fairly simple task as checking domain status should be available through CLI directly as, for example:
virtualmin list-domains --domain $dom --status
that would output either "Enabled" or "Disabled". I don't know if this feature request will be accepted or not, in either way would be nice to update the documentation page on https://www.virtualmin.com/documentation/developer/cli/list_domains, which gives only these options:
virtualmin list-domains [--multiline | --name-only | --id-only |
--simple-multiline | --user-only | --home-only]
[--domain name]*
[--user name]*
[--id number]*
[--with-feature feature]
[--without-feature feature]
[--alias | --no-alias | --subserver |
--toplevel | --subdomain]
[--plan ID|name]
[--reseller name | --no-reseller |
--any-reseller]
Compare with what the command gives on CLI:
virtualmin list-domains [--multiline | --name-only | --id-only |
--simple-multiline | --user-only |
--home-only | --file-only]
[--domain name]*
[--user name]*
[--mail-user name]*
[--id number]*
[--with-feature feature]
[--without-feature feature]
[--alias domain | --no-alias]
[--subserver | --toplevel | --subdomain]
[--parent domain]
[--plan ID|name]
[--template ID|name]
[--disabled | --enabled]
Status:
Active
Comments
Submitted by yngens on Sun, 08/13/2017 - 18:44 Comment #1
Submitted by yngens on Sun, 08/13/2017 - 18:45 Comment #2
Submitted by yngens on Sun, 08/13/2017 - 21:00 Comment #3
Submitted by JamieCameron on Mon, 08/14/2017 - 20:03 Comment #4
You can use the
--name-only
flag tolist-domains
to get just the full domain names, rather than the human-friendly table format.Submitted by yngens on Tue, 08/15/2017 - 04:55 Comment #5
Thanks James, I know that and, unfortunately, that doesn't answer the initial question in the title of this request.
Submitted by JamieCameron on Tue, 08/15/2017 - 18:05 Comment #6
You could use a command like :
virtualmin list-domains --domain yourdomain.com --disabled
If the domain is disabled, this will output the name. Otherwise, it will output nothing.
Submitted by yngens on Thu, 08/17/2017 - 15:35 Comment #7
Now, read my initial post - I used exactly that pattern and it has its own flows. It will not output domian name,
virtualmin list-domains --domain $dom --disabled
will output only partially cut (30 symbols) domain name. Try with long domain names.Submitted by JamieCameron on Thu, 08/17/2017 - 21:24 Comment #8
My mistake, the command should be
virtualmin list-domains --domain yourdomain.com --disabled --name-only
Submitted by yngens on Fri, 08/18/2017 - 00:28 Comment #9
Thanks for the hint as your suggestion makes our additional script some simpler. However, still wouldn't be nice to have something like
virtualmin list-domains --domain $dom --status
which would output either "Enabled" or "Disabled"?
If it complicates things don't bother as we already have solution for our use case. I am just thinking to make it better for Virtualmin CLI.
Submitted by JamieCameron on Fri, 08/18/2017 - 19:26 Comment #10
Sure, but I want to keep the API simple and consistent, rather than adding too many special cases.