พยายามหา script update cloudflare dns records (ทำ ddns ครับ) หาจนมือหงิก นิ้วล๊อคแล้วครับ ไม่มีที่ใช้ได้เลย มีที่ดีที่สุดที่หามาได้ ก็ script ข้างล่างครับ แต่ติดปัญหา nslookup not found ทีบรรทัด
CFHOSTIP=$(nslookup $(echo $CFHOSTS | cut -d ',' -f1)$CFNS | grep Address | tail -1 | cut -d ' ' -f2)
อันนี้ Script ตัวเต็มครับ
#!/bin/bash
# CloudFlare-registered email address
CFU=xxxxxxxxxxxxx
# API key
xxxxxxxxxxxxx
# The first nameserver CloudFlare gave you
CFNS=carl.ns.cloudflare.com
# The URL you want to update the IP address for,
# you can use a comma-separated list for multiple
CFHOSTS=xxxxxxxxxxxxxxxx
# Get our current external IP address
CFIP=$(curl -s
http://myip.dnsomatic.com/)
# Build the URL you need to do the update
CFURL="
https://www.cloudflare.com/api.html?a=DIUP&hosts=$CFHOSTS&u=$CFU&tkn=$CFP&ip=$CFIP"
# Check current CloudFlare-listed IP address
CFHOSTIP=$(nslookup $(echo $CFHOSTS | cut -d ',' -f1)$CFNS | grep Address | tail -1 | cut -d ' ' -f2)
# If IPs differ, update CloudFlare
if [ "$CFIP" != "$CFHOSTIP" ]
then
/usr/bin/curl -s $CFURL
fi
ท่านใดจะกรุณาแก้ Script นี้ หรือ แนะนำอันใหม่ หรือ link หรือ วิธีการอื่น ก็ขอบคุณมากครับ หามา 3 วัน พิมพ์ keyboard นิ้วจะไม่ยอมขยับแล้วครับ
ขอบคุณครับ
raspberry pi 3 update cloudflare dns records
CFHOSTIP=$(nslookup $(echo $CFHOSTS | cut -d ',' -f1)$CFNS | grep Address | tail -1 | cut -d ' ' -f2)
อันนี้ Script ตัวเต็มครับ
#!/bin/bash
# CloudFlare-registered email address
CFU=xxxxxxxxxxxxx
# API key
xxxxxxxxxxxxx
# The first nameserver CloudFlare gave you
CFNS=carl.ns.cloudflare.com
# The URL you want to update the IP address for,
# you can use a comma-separated list for multiple
CFHOSTS=xxxxxxxxxxxxxxxx
# Get our current external IP address
CFIP=$(curl -s http://myip.dnsomatic.com/)
# Build the URL you need to do the update
CFURL="https://www.cloudflare.com/api.html?a=DIUP&hosts=$CFHOSTS&u=$CFU&tkn=$CFP&ip=$CFIP"
# Check current CloudFlare-listed IP address
CFHOSTIP=$(nslookup $(echo $CFHOSTS | cut -d ',' -f1)$CFNS | grep Address | tail -1 | cut -d ' ' -f2)
# If IPs differ, update CloudFlare
if [ "$CFIP" != "$CFHOSTIP" ]
then
/usr/bin/curl -s $CFURL
fi
ท่านใดจะกรุณาแก้ Script นี้ หรือ แนะนำอันใหม่ หรือ link หรือ วิธีการอื่น ก็ขอบคุณมากครับ หามา 3 วัน พิมพ์ keyboard นิ้วจะไม่ยอมขยับแล้วครับ
ขอบคุณครับ