Hallo
try and error / not error
Es ist ist das gleiche Format wie /etc/hosts
Mein Skript sieht verkürzt so aus :
#!/bin/bash # teste auf Präsenz von Rechnern mit ULA im Intranet und aktualisiere IPv6 Adresseinträge
HOSTSDIR=$(grep hostsdir /etc/dnsmasq.d/config_ipv6.conf |\ cut -d '=' -f 2 ) [ -d "$HOSTSDIR" ] || mkdir -p "$HOSTSDIR"
for REMOTE_HOST in Host1 Host2 Host3 ; do if ping -4 -c 1 -w 1 $REMOTE_HOST > /dev/null then [ -f "$HOSTSDIR$REMOTE_HOST".conf ] || { REMOTE_HOST_IPV6_old=$(awk '{print $1}' < "$HOSTSDIR$REMOTE_HOST".conf) REMOTE_HOST_IPV6=$(ssh -4 root@$REMOTE_HOST 'ip a' | grep "inet6 fd22" | awk '{print $2}'| cut -d "/" -f 1) if [ "$REMOTE_HOST_IPV6_old" == "$REMOTE_HOST_IPV6" ] then continue else echo "$REMOTE_HOST_IPV6 $REMOTE_HOST" > "$HOSTSDIR$REMOTE_HOST".conf fi } else echo 'PingExitCode <> 0' [ -f "$HOSTSDIR$REMOTE_HOST".conf ] && rm "$HOSTSDIR$REMOTE_HOST".conf fi done
exit 0
und läuft durch einen job in /etc/cron.d alle 3 Minuten
Am 10.10.25 um 15:59 schrieb Erich Minderlein:
Hallo
im Nachgang zu unterstehendem habe ich mir ein bash Skript gemacht welches die ipv6 der hosts abfragt und in --hostsdir einträgt
man dnsmasq Manual page dnsmasq(8) line 43/1449 5% --hostsdir=<path> Read all the hosts files contained in the directory. New or changed files are read automatically and modified and deleted files have removed records automatically deleted.
Ich habe aber nirgendwo gefunden, welches Format die Adresseinträge in den Dateien haben müssen.
Weiß das wer ?
Am 08.10.25 um 22:39 schrieb Erich Minderlein:
Hallo