Last active
January 25, 2021 15:03
-
-
Save dd-han/153eb1595b7c144ff6c8123edbadcc41 to your computer and use it in GitHub Desktop.
put file in /jffs/ after flash MERLIN firmware
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
EMAIL="[email protected]" | |
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