Hello,
so i created bash script to update one single domain, and domain pings to my server, but it stopped working few days ago can you help me:

my script logs:

Machine IP: 87.110.89.178
Domain config: {"domain_record":{"id":XXXXXX,"type":"A","name":"XXXXXXXX","data":"91.105.118.11","priority":null,"port":null,"ttl":3600,"weight":null}}
Update domain DNS required!
Domain Old Ip: 91.105.118.11
New Ip: 87.110.89.178
Response of Domain DNS update: {"id":"not_found","message":"The resource you were accessing could not be found."}

where is the issue? if worked i dont know, few days ago

edited by asb

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

As it says, “The resource you were accessing could not be found.”. Double check the ID.

  • Yes, I can read and I also compared thous id, and its compeleatly the same as in first response. It worked time ago, and i don`t think that domain id is not unique and floating id witch updates in one domain/sub-domain lifecycle

    there is my bash code:

    #!/bin/bash
    # Ubuntu package "jq" should be inststalled on machine
    
    ip=$(curl -ss ipinfo.io/ip)
    echo "Machine IP: $ip"
    
    token="XXXXXXX" // tocen form my account
    domain="XXXXXXX" // domain name (not sub)
    record="XXXXXX" // sub-domain id
    
    cdd=$(curl -ss GET -H "Content-Type: application/json" -H "Authorization: Bearer $token" "https://api.digitalocean.com/v2/domains/$domain/records/$record")
    echo "Domain config: $cdd"
    
    doDomainIp=$(echo $cdd | jq '.domain_record.data' | tr -d '"')
    
    if [ "$ip" != "$doDomainIp" ]; then
        echo "Update domain DNS required!"
        echo "Domain Old Ip: $doDomainIp"
        echo "New Ip: $ip"
    
    call=$(curl -ss PUT -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d '{"data":"'$ip'"}' "https://api.digitalocean.com/v2/domains/$domain/records/$record")
    
        echo "Response of Domain DNS update: $call"
    
    else
        echo "Domain is setted up!"
        echo "Machine ip: $ip"
        echo "Domain ip: $doDomainIp"
    fi
    
    edited by asb
    • Show the output of list domains and stop hiding the ID and domain - they’re not private.

      • domain="domonk.com"
        record="25114227"
        

        and sub-domain name i preffeare to leave hidden form of it is like:
        dasda-dasda-adas.dasd.das.domonk.com

        and output of this bash script is in first post:

        {"id":XXXXXX,"type":"A","name":"XXXXXXXX","data":"91.105.118.11","priority":null,"port":null,"ttl":3600,"weight":null}}
        
        edited by asb
Submit an Answer