So I'm trying to set up a dynamic DNS thing that would allow me to connect to my home PC with dynamic IP address remotely.
I've set up a system cronjob in /etc/crontab to execute a script every 5 minutes:
*/5 * * * * root /home/pl/bin/dyndns.sh
I've verified that this works by running
grep CRON /var/log/syslog
Now, the script itself is as follows:
#!/bin/bash
LOGIN="[email protected]"
TOKEN="my API token"
DOMAIN_ID="mydomain.com"
RECORD_ID="ID of the A record"
IP=`curl -s http://icanhazip.com/`
curl -H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-DNSimple-Token: $LOGIN:$TOKEN" \
-X "PUT" \
-i "https://api.dnsimple.com/v1/domains/$DOMAIN_ID/records/$RECORD_ID" \
-d "{\"record\":{\"content\":\"$IP\"}}"
Yet the record doesn't change. What could be the problem?