Update update-hosts-lxc.sh

This commit is contained in:
Mattia Tadini 2025-01-14 16:56:04 +00:00
parent 7fa2306101
commit 9813796cf4

View File

@ -23,7 +23,7 @@ echo "$SERVER_IP $SERVER_NAME" > /tmp/new_hosts
# Leggi il contenuto originale di /etc/hosts
while IFS= read -r line; do
# Ignora le righe che contengono SERVER_IP ma non SERVER_NAME
if [[ ! "$line" == *"$SERVER_IP"* ]] || [[ "$line" == *"127.0.0.1 $SERVER_NAME"* ]]; then
if [[ ! "$line" == *"$SERVER_IP"* ]] || [[ "$line" == *"127.0.1.1 $SERVER_NAME"* ]]; then
echo "$line" >> /tmp/new_hosts
fi
done < /etc/hosts