Skip to content

Instantly share code, notes, and snippets.

@dd-han
Last active January 25, 2021 15:03
Show Gist options
  • Save dd-han/153eb1595b7c144ff6c8123edbadcc41 to your computer and use it in GitHub Desktop.
Save dd-han/153eb1595b7c144ff6c8123edbadcc41 to your computer and use it in GitHub Desktop.
put file in /jffs/ after flash MERLIN firmware
#!/bin/sh
EMAIL="username@gmail.com"
ZONEID="your_zone_id"
RECORDID="to_update_record_id"
RECORDNAME="to_update_name"
RECORDTTL="1"
API="your_api_key"
IP=${1}
RES=`curl -s -X PUT "https://api.cloudflare.com/client/v4/zones/${ZONEID}/dns_records/${RECORDID}" \
-H "X-Auth-Email: ${EMAIL}" \
-H "X-Auth-Key: ${API}" \
-H "Content-Type: application/json" \
--data "{\"type\":\"A\",\"name\":\"${RECORDNAME}\",\"content\":\"${IP}\",\"ttl\":${RECORDTTL},\"proxied\":false}"`
echo $RES | grep '"success":\ *true' > /dev/null
if [ $? -eq 0 ]; then
#echo success
/sbin/ddns_custom_updated 1
else
#echo failed
/sbin/ddns_custom_updated 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment