Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Works on Raspberry Pi, but not on Mac #72

Open
petebocken opened this issue Oct 14, 2023 · 0 comments
Open

Works on Raspberry Pi, but not on Mac #72

petebocken opened this issue Oct 14, 2023 · 0 comments

Comments

@petebocken
Copy link

The script has worked perfectly fine for almost a year on a Raspberry Pi. However, when I run it on my Mac mini (macOS 13.6), it runs fine with no errors, but does not update the Cloudflare DNS entry. I am simply copying the same exact script file over.

The Pi and Mac are on different subnets, but nothing should be getting blocked on the Mac.

Output of bash -x ./script.sh

+ auth_email=[REDACTED]
+ auth_method=global
+ auth_key=[REDACTED]
+ zone_identifier=[REDACTED]
+ record_name=[REDACTED]
+ ttl=3600
+ proxy=false
+ sitename=
+ slackchannel=
+ slackuri=
+ discorduri=
+ ipv4_regex='([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])'
++ curl -s -4 https://cloudflare.com/cdn-cgi/trace
++ grep -E '^ip'
+ ip=ip=[REDACTED]
+ ret=0
+ [[ ! 0 == 0 ]]
++ echo ip=[REDACTED]
++ sed -E 's/^ip=(([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5]))$/\1/'
+ ip=[REDACTED]
+ [[ ! [REDACTED] =~ ^([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])$ ]]
+ [[ global == \g\l\o\b\a\l ]]
+ auth_header=X-Auth-Key:
+ logger 'DDNS Updater: Check Initiated'
++ curl -s -X GET 'https://api.cloudflare.com/client/v4/zones/[REDACTED]/dns_records?type=A&name=[REDACTED]' -H 'X-Auth-Email: [REDACTED]' -H 'X-Auth-Key: [REDACTED]' -H 'Content-Type: application/json'
+ record='{"result":[{"id":"[REDACTED]","zone_id":"[REDACTED]","zone_name":"[REDACTED]","name":"[REDACTED]","type":"A","content":"9.9.9.9","proxiable":true,"proxied":false,"ttl":3600,"locked":false,"meta":{"auto_added":false,"managed_by_apps":false,"managed_by_argo_tunnel":false,"source":"primary"},"comment":null,"tags":[],"created_on":"2023-01-21T16:18:28.453902Z","modified_on":"2023-10-14T14:17:01.335789Z"}],"success":true,"errors":[],"messages":[],"result_info":{"page":1,"per_page":100,"count":1,"total_count":1,"total_pages":1}}'
+ [[ {"result":[{"id":"[REDACTED]","zone_id":"[REDACTED]","zone_name":"[REDACTED]","name":"[REDACTED]","type":"A","content":"9.9.9.9","proxiable":true,"proxied":false,"ttl":3600,"locked":false,"meta":{"auto_added":false,"managed_by_apps":false,"managed_by_argo_tunnel":false,"source":"primary"},"comment":null,"tags":[],"created_on":"2023-01-21T16:18:28.453902Z","modified_on":"2023-10-14T14:17:01.335789Z"}],"success":true,"errors":[],"messages":[],"result_info":{"page":1,"per_page":100,"count":1,"total_count":1,"total_pages":1}} == *\"\c\o\u\n\t\"\:\0* ]]
++ echo '{"result":[{"id":"[REDACTED]","zone_id":"[REDACTED]","zone_name":"[REDACTED]","name":"[REDACTED]","type":"A","content":"9.9.9.9","proxiable":true,"proxied":false,"ttl":3600,"locked":false,"meta":{"auto_added":false,"managed_by_apps":false,"managed_by_argo_tunnel":false,"source":"primary"},"comment":null,"tags":[],"created_on":"2023-01-21T16:18:28.453902Z","modified_on":"2023-10-14T14:17:01.335789Z"}],"success":true,"errors":[],"messages":[],"result_info":{"page":1,"per_page":100,"count":1,"total_count":1,"total_pages":1}}'
++ sed -E 's/.*"content":"(([0-9]{1,3}\.){3}[0-9]{1,3})".*/\1/'
+ old_ip=9.9.9.9
+ [[ [REDACTED] == 9.9.9.9 ]]
++ echo '{"result":[{"id":"[REDACTED]","zone_id":"[REDACTED]","zone_name":"[REDACTED]","name":"[REDACTED]","type":"A","content":"9.9.9.9","proxiable":true,"proxied":false,"ttl":3600,"locked":false,"meta":{"auto_added":false,"managed_by_apps":false,"managed_by_argo_tunnel":false,"source":"primary"},"comment":null,"tags":[],"created_on":"2023-01-21T16:18:28.453902Z","modified_on":"2023-10-14T14:17:01.335789Z"}],"success":true,"errors":[],"messages":[],"result_info":{"page":1,"per_page":100,"count":1,"total_count":1,"total_pages":1}}'
++ sed -E 's/.*"id":"(\w+)".*/\1/'
+ record_identifier='{"result":[{"id":"[REDACTED]","zone_id":"[REDACTED]","zone_name":"[REDACTED]","name":"[REDACTED]","type":"A","content":"9.9.9.9","proxiable":true,"proxied":false,"ttl":3600,"locked":false,"meta":{"auto_added":false,"managed_by_apps":false,"managed_by_argo_tunnel":false,"source":"primary"},"comment":null,"tags":[],"created_on":"2023-01-21T16:18:28.453902Z","modified_on":"2023-10-14T14:17:01.335789Z"}],"success":true,"errors":[],"messages":[],"result_info":{"page":1,"per_page":100,"count":1,"total_count":1,"total_pages":1}}'
++ curl -s -X PATCH 'https://api.cloudflare.com/client/v4/zones/[REDACTED]/dns_records/{"result":[{"id":"[REDACTED]","zone_id":"[REDACTED]","zone_name":"[REDACTED]","name":"[REDACTED]","type":"A","content":"9.9.9.9","proxiable":true,"proxied":false,"ttl":3600,"locked":false,"meta":{"auto_added":false,"managed_by_apps":false,"managed_by_argo_tunnel":false,"source":"primary"},"comment":null,"tags":[],"created_on":"2023-01-21T16:18:28.453902Z","modified_on":"2023-10-14T14:17:01.335789Z"}],"success":true,"errors":[],"messages":[],"result_info":{"page":1,"per_page":100,"count":1,"total_count":1,"total_pages":1}}' -H 'X-Auth-Email: [REDACTED]' -H 'X-Auth-Key: [REDACTED]' -H 'Content-Type: application/json' --data '{"type":"A","name":"[REDACTED]","content":"[REDACTED]","ttl":"3600","proxied":false}'
+ update=
+ case "$update" in
+ logger 'DDNS Updater: [REDACTED] [REDACTED] DDNS updated.'
+ [[ '' != '' ]]
+ [[ '' != '' ]]
+ exit 0

Output of debug script dev-ipv4.sh

Oct 14 09:47:47  peter[10813] <Notice>: DDNS Updater: Check Initiated
./dev-ipv4.sh: line 112: -4: substring expression < 0
./dev-ipv4.sh: line 163: -4: substring expression < 0
Oct 14 09:47:47  peter[10828] <Notice>: DDNS Updater: [REDACTED] [REDACTED] DDNS updated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant