From dc7766a093134ff79e55793f45f252dd4ef96608 Mon Sep 17 00:00:00 2001 From: Edi Septriyanto Date: Thu, 17 Feb 2022 08:14:52 +0700 Subject: [PATCH] Fix /etc/hosts add --- scripts/helper.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/helper.sh b/scripts/helper.sh index 170ca09..de1eef5 100644 --- a/scripts/helper.sh +++ b/scripts/helper.sh @@ -508,6 +508,7 @@ function preflight_system_check() { if grep -q "${SERVER_HOSTNAME}" /etc/hosts; then run sed -i".bak" "/${SERVER_HOSTNAME}/d" /etc/hosts + run bash -c "echo -e '${SERVER_IP_LOCAL}\t${SERVER_HOSTNAME}' >> /etc/hosts" else run bash -c "echo -e '\n# LEMPer local hosts\n${SERVER_IP_LOCAL}\t${SERVER_HOSTNAME}' >> /etc/hosts" fi @@ -528,8 +529,8 @@ function preflight_system_check() { # Check if the hostname is pointed to server IP address. if [[ $(dig "${HOSTNAME}" +short) != "${SERVER_IP}" && $(dig "${HOSTNAME}" +short) != "${SERVER_IP_LOCAL}" ]]; then - error "It seems that your server's hostname '${HOSTNAME}' is not yet pointed to your server's IP address." - echo -n "In production environment you should add an A record and points it to this server IP address "; status -n "${SERVER_IP}"; echo " !" + error "It seems that your server's hostname '${HOSTNAME}' is not yet pointed to your server's public IP address." + echo -n "In production environment you need to add an A record and point it to this IP address "; status -n "${SERVER_IP}"; echo " !" exit 1 fi fi