16 lines
468 B
Bash
Executable File
16 lines
468 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Serverdetails
|
|
DNS_SERVER="server_url"
|
|
DNS_ZONE="zone"
|
|
API_TOKEN="token"
|
|
|
|
# Hostnamen und IP-Adresse ermitteln
|
|
HOSTNAME=$(hostname)
|
|
IP_ADDRESS=$(hostname -I | awk '{print $1}')
|
|
|
|
# API-Anfrage senden mit Token als Query-Parameter
|
|
curl "http://$DNS_SERVER:5380/api/zones/records/add?domain=$HOSTNAME.$DNS_ZONE&zone=$DNS_ZONE&type=A&overwrite=true&IPAddress=$IP_ADDRESS&token=$API_TOKEN"
|
|
|
|
echo "DNS-Eintrag für $HOSTNAME ($IP_ADDRESS) wurde aktualisiert."
|