Koozali.org: home of the SME Server

Obsolete Releases => SME Server 9.x => Topic started by: guest22 on March 07, 2017, 06:00:25 PM

Title: [SOLVED] detecting all domain names
Post by: guest22 on March 07, 2017, 06:00:25 PM
Hi,

the command 'hostname' detects (I guess vir /etc/hosts) the short or full FQDN. But how can one detect or the added domains like sub.mydomain.com?

TIA
Title: Re: detecting all domain names
Post by: devtay on March 07, 2017, 06:10:36 PM
Maybe try
Code: [Select]
db domains showNot sure if that's what you are looking for or not.
Title: Re: detecting all domain names
Post by: guest22 on March 07, 2017, 06:17:29 PM
Maybe try
Code: [Select]
db domains showNot sure if that's what you are looking for or not.


Thanks, that will list all the domain details, I would looking for a way to list all the domains as 'hostname-d' does.

Title: Re: detecting all domain names
Post by: Stefano on March 07, 2017, 06:57:35 PM
Thanks, that will list all the domain details, I would looking for a way to list all the domains as 'hostname-d' does.

can you make an example of the desired output?
domains are in domains db
if you need hostnames, you've to use the hosts db
Title: Re: detecting all domain names
Post by: guest22 on March 07, 2017, 06:59:10 PM
srv1.mydomain.com
mydomain.com
sub1.mydomai.com
sub2.mydomain

e.g. all domains listed as in server manager -> domains
Title: Re: detecting all domain names
Post by: Stefano on March 07, 2017, 07:07:35 PM
Code: [Select]
db domains show | grep '=domain' | sed s/=domain$//

HTH
Title: Re: detecting all domain names
Post by: guest22 on March 07, 2017, 07:16:01 PM
Code: [Select]
db domains show | grep '=domain' | sed s/=domain$//

HTH


Perfect, thanks.