From ccc68b09fdd17cb41052eaf9eda52d9e422f6e1d Mon Sep 17 00:00:00 2001 From: David Beniamine <david.beniamine@tetras-libre.fr> Date: Fri, 25 Oct 2019 11:32:39 +0200 Subject: [PATCH] Reegenerate host file --- regenerate_hosts.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 regenerate_hosts.sh diff --git a/regenerate_hosts.sh b/regenerate_hosts.sh new file mode 100755 index 0000000..76dcacc --- /dev/null +++ b/regenerate_hosts.sh @@ -0,0 +1,21 @@ +#!/bin/bash +BASE_MACS="6c:4b:90 a4:1f:72 78:45:c4 64:00:6a b0:83:fe d4:be:d9 00:23:24" +arg="c8:1f:66" +for mac in $BASE_MACS +do + arg="$arg \| $mac" +done +echo grep "$arg" /var/lib/dhcp/dhcpd.leases +MACS="" +for line in $(grep "$arg" /var/lib/dhcp/dhcpd.leases | sort -u) +do + if [ "$line" != "hardware" ] && [ "$line" != "ethernet" ] + then + MACS="$MACS $(echo $line | sed 's/;$//g')" + fi +done +for mac in $MACS +do + echo "20191025 $mac inconnuAutoGen" >> /etc/registry/hosts +done +systemctl restart registry wakeonlan -- GitLab