add dyndns scripts
This commit is contained in:
parent
47d2132170
commit
2b5dbf6831
|
@ -0,0 +1,22 @@
|
|||
#!/bin/sh
|
||||
|
||||
ttl=300
|
||||
ip=${1}
|
||||
|
||||
second_level_domain="$domain"
|
||||
subdomain="{@}"
|
||||
|
||||
depth=$(echo "$domain" | grep -o "[.]" | wc -l)
|
||||
|
||||
if [ "$depth" -ge 2 ]; then
|
||||
second_level_domain=$(echo "$domain" | cut -s -d '.' -f ${depth}-)
|
||||
subdomain=$(echo "$domain" | cut -s -d '.' -f -$((depth - 1)))
|
||||
fi
|
||||
|
||||
echo "second_level_domain = ${second_level_domain}"
|
||||
echo "subdomain = ${subdomain}"
|
||||
|
||||
curl -fs -o /dev/null -X PUT -H "Content-Type: application/json" \
|
||||
-H "X-Api-Key: ${password}" \
|
||||
-d "{\"rrset_ttl\": ${ttl}, \"rrset_values\": [\"${ip}\"]}" \
|
||||
"https://dns.api.gandi.net/api/v5/domains/${second_level_domain}/records/${subdomain}/A"
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
|
||||
ttl=300
|
||||
ip=${1}
|
||||
|
||||
contents="[{\"content\":\"${ip}\"}]"
|
||||
|
||||
curl -fs \
|
||||
-X POST -H "Content-Type: application/json" \
|
||||
-d "{\"authToken\":\"${password}\",\"hostname\":\"${domain}\",\"recordType\":\"A\",\"rrSetContents\":${contents},\"removeAllRecords\":\"true\"}" \
|
||||
"https://secure.hosting.de/api/dns/v1/json/resourceRecordSetUpdate"
|
Loading…
Reference in New Issue