domain + subdomain

This commit is contained in:
pvincent
2024-10-09 11:38:59 +04:00
parent 5ac2e4842d
commit ac7268731a
10 changed files with 179 additions and 28 deletions
+22
View File
@@ -0,0 +1,22 @@
#!/bin/bash
function check_db_maria_exists() {
db-maria list | grep -q "$1"
}
function check_db_postgres_exists() {
db-psql list | grep -q "$1"
}
function extract_domain_from_fqdn() {
fqdn=$1
part1=$(builtin echo "$fqdn" | rev | cut -d'.' -f1 | rev)
part2=$(builtin echo "${fqdn%."$part1"}" | rev | cut -d'.' -f1 | rev)
builtin echo "$part2.$part1"
}
function extract_subdomain_from_fqdn() {
fqdn=$1
domain=$(extract_domain_from_fqdn "$fqdn")
builtin echo "${fqdn%."$domain"}"
}