cloudron-support: check if whois installed

This commit is contained in:
Girish Ramakrishnan
2023-12-14 17:07:51 +01:00
parent a54c6d3c32
commit 8b5afaa12c

View File

@@ -177,6 +177,11 @@ function check_hairpin_nat() {
}
function check_expired_domain() {
if ! command -v whois &> /dev/null; then
echo "Domain expiry check skipped because whois is not installed. Run 'apt install whois' to check"
exit 0
fi
local -r dashboard_domain=$(mysql -NB -uroot -ppassword -e "SELECT value FROM box.settings WHERE name='dashboard_domain'" 2>/dev/null)
local -r expdate=$(whois ${dashboard_domain} | egrep -i 'Expiration Date:|Expires on|Expiry Date:' | head -1 | awk '{print $NF}')
local -r expdate_secs=$(date -d"$expdate" +%s)