Koozali.org: home of the SME Server

[SOLVED] detecting all domain names

guest22

[SOLVED] detecting all domain names
« 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

Offline devtay

  • *
  • 145
  • +0/-0
Re: detecting all domain names
« Reply #1 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.
You can't stop what's coming. It ain't all waiting on you.

guest22

Re: detecting all domain names
« Reply #2 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.


Offline Stefano

  • *
  • 10,839
  • +2/-0
Re: detecting all domain names
« Reply #3 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

guest22

Re: detecting all domain names
« Reply #4 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

Offline Stefano

  • *
  • 10,839
  • +2/-0
Re: detecting all domain names
« Reply #5 on: March 07, 2017, 07:07:35 PM »
Code: [Select]
db domains show | grep '=domain' | sed s/=domain$//

HTH

guest22

Re: detecting all domain names
« Reply #6 on: March 07, 2017, 07:16:01 PM »
Code: [Select]
db domains show | grep '=domain' | sed s/=domain$//

HTH


Perfect, thanks.