Created
October 2, 2021 14:31
-
-
Save 0neday/f6d87b2c472a3945eaabe598987d8515 to your computer and use it in GitHub Desktop.
Revisions
-
0neday created this gist
Oct 2, 2021 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ #!/bin/bash BIN_DIR=/mnt/jffs2/plug/app/busybox export PATH=$BIN_DIR/bin:$BIN_DIR/sbin:$BIN_DIR/usr/bin:$BIN_DIR/usr/sbin DOMAIN='' NAME='' APIKEY='' CAFILE="/mnt/jffs2/hw/etc/ssl/certs/ca-certificates.crt" CURL_BIN="/mnt/jffs2/plug/app/bin/curl" IPV4=$(ifconfig ppp257 | grep 'inet addr' | awk '{print $2}' | awk -F ':' '{print $2}') record_response_json=$($CURL_BIN --cacert $CAFILE -s -X GET -H "Authorization: Bearer ${APIKEY}" "https://api.vultr.com/v2/domains/$DOMAIN/records") records_id=$(echo $record_response_json | sed -E "s/.+\,\{\"id\":\"([a-f0-9-]+)\".+\"$NAME\".+/\1/g") $CURL_BIN --cacert $CAFILE -s -X PATCH -H "Authorization: Bearer ${APIKEY}" "https://api.vultr.com/v2/domains/$DOMAIN/records/$records_id" -H "Content-Type: application/json" --data "{\"name\":\"$NAME\",\"type\":\"A\",\"data\":\"$IPV4\",\"ttl\":120, \"priority\":0}"