yulewang / cloudflare-api-v4-ddns Goto Github PK
View Code? Open in Web Editor NEWCloudflare API v4 Dynamic DNS Update in Bash
Cloudflare API v4 Dynamic DNS Update in Bash
如何检测不是代理的ip
在脚本中有如下:
grep -Po '(?<="id":")[^"]*' | head -1 )
但是我当前环境是 BusyBox v1.24.1,貌似不支持这个 -- ‘P’的参数, 如何修改呢?
当前执行后报错:
No file, need IP
Updating zone_identifier & record_identifier
grep: invalid option -- 'P'
BusyBox v1.24.1 (2022-03-24 03:19:19 CST) multi-call binary.
Usage: grep [-HhnlLoqvsriwFE] [-m N] [-A/B/C N] PATTERN/-e PATTERN.../-f FILE [FILE]...
Search for PATTERN in FILEs (or stdin)
-H Add 'filename:' prefix
-h Do not add 'filename:' prefix
-n Add 'line_no:' prefix
-l Show only names of files that match
-L Show only names of files that don't match
-c Show only count of matching lines
-o Show only the matching part of line
-q Quiet. Return 0 if PATTERN is found, 1 otherwise
-v Select non-matching lines
-s Suppress open and read errors
-r Recurse
-i Ignore case
-w Match whole words only
-x Match whole lines only
-F PATTERN is a literal (not regexp)
-E PATTERN is an extended regexp
-m N Match up to N times per file
-A N Print N lines of trailing context
-B N Print N lines of leading context
-C N Same as '-A N -B N'
-e PTRN Pattern to match
-f FILE Read pattern from file
(23) Failed writing body
from: x-auth-key
to: Authorization: Bearer
每次./脚本后
输出“no file.need ip” 和 “Updating zone_identifier & record_identifier”后无反应
cf面板未更新ip,且本地未生成两个存档数据的txt文件
我使用了全局api key 并且在两台机器上分别使用debian和centos做过测试,也用文件内使用方法在/usr目录下实验过
能想到的原因均测试过,实在没办法请教大佬们,希望有大佬解惑
Can you make this a Docker image?
Updating zone_identifier & record_identifier
Updating DNS to 1.1.1.1
cf-v4-ddns.sh: line 140: [: !=: unary operator expected
Something went wrong :(
Response: {
"result": {
"id": "e11ce34e68aab16cdc2a93a690cb5935",
"zone_id": "9fca16d42d77e6f2336df8059a021193",
"zone_name": "xx.ltd",
"name": "azure.xx.ltd",
"type": "A",
"content": "1.1.1.1",
"proxiable": true,
"proxied": false,
"ttl": 120,
"locked": false,
"meta": {
"auto_added": false,
"managed_by_apps": false,
"managed_by_argo_tunnel": false,
"source": "primary"
},
"created_on": "2020-03-14T10:18:03.449524Z",
"modified_on": "2020-03-14T10:18:03.449524Z"
},
"success": true,
"errors": [],
"messages": []
}
应该是解析json出错了
首先感谢大大精简好用的代码,在config填写正确的情况下没有问题,可以正常使用。
出于好奇自己研究了下
在API错误情况下打印:
No file, need IP
Updating zone_identifier & record_identifier
测试了下
大概出现在这个位置
cloudflare-api-v4-ddns/cf-v4-ddns.sh
Line 123 in 1336b07
修不来……我爬了
我是在crontab里做的定时任务
*/5 * * * * cf-v4-ddns.sh >> /home/latezly/cf-ddns.log 2>&1
刚开始启动的时候一直是正常的
过了一段时间就开始报这个错误
Updating DNS to error code: 1020
Something went wrong :(
Response: {"result":null,"success":false,"errors":[{"code":9005,"message":"Content for A record must be a valid IPv4 address."}],"messages":[]}
If record is not exist, It is better to add an echo message or use the add record api.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.