butterknife-provisioning-image/overlay/sbin/butterknife-discover

13 lines
473 B
Plaintext
Raw Normal View History

2021-02-22 22:32:51 +00:00
dig -t ANY @224.0.0.251 -p5353 +noall +answer _butterknife._tcp.local | grep "IN SRV" | while read line; do
hostname=$(echo $line | cut -d " " -f 8)
address=$(dig +short +noall +answer @224.0.0.251 -p5353 $hostname | head -n1)
port=$(echo $line | cut -d " " -f 7)
title=$(echo $line | cut -d "." -f 1 | sed -e 's/\032/ /g')
if [ $port -eq 80 ]; then
echo "http://$address \"$title\""
else
echo "http://$address:$port \"$title\""
fi
done