#!/bin/bash

exec 2>&1

host="$(cat /etc/hostname)"

echo "Updating /etc/hosts file"
cat <<EOF >/etc/hosts
127.0.0.1 localhost $host type $host.local type.local
::1 localhost $host type $host.local type.local

192.168.1.1 server control server.local control.local

$(/opt/admin/bin/tl-stat ipv4 host host | sed -e 's/ *$/.local/')
EOF

exec sleep 30
