Closed FernandoMarques-Santos closed 3 years ago
The script doesn't need to be run as root. I would just run it as a regular user. In fact, I would delete the config, the cron job, checking both user cron and the root cron to be sure. Then I would clone and run the script again from the start as a regular user.
Once that's done, you will want to start logging the cron job instead of outputting it into /dev/null so that we could see what was happening.
Are you using the most recent version of the script? I added more verbose logging in the latest version. Cloning the repo should fix that issue if you are using an old copy.
Thanks James, not sure what was wrong, but now it seems fixed. I will detail my (baby) steps here so anyone can do the same.
I started by deleting all the script and config files.
rm autoconf-duckdns6.sh duckdns6.sh .duck6.conf
Then I removed the duckdns cronjobs checking both:
sudo crontab -e crontab -e
Next, I downloaded the updated script to my home folder:
wget https://raw.githubusercontent.com/gtwy/IPv6forDuckDNS/master/autoconf-duckdns6.sh
Added the permission to execute the script by the user
sudo chmod u+x autoconf-duckdns6.sh
Ran the script using ./
./autoconf-duckdns6.sh
The script will ask for domain and token as usual. IPv4 it will find automatically, so just press enter
Check if the crontab is enabled to the user (if using nano, crt+x to close)
crontab -e
After five minutes, check if the crontab is actually running:
grep -i duckdns /var/log/syslog
If your IPv4 and IPv6 are already correct in duckdns (let's say that you updated it manually just so you can use the thing as is), you can't really see if the IPv6forDuckDNS script is working, because it will report "OK" regardless if any modification occurred. So I went to duckdns site and changed both my IPs (changed a random number and refreshed). Go get a coffee and wait 5 minutes for cron to refresh the duckdns. See if it is refreshed on the duck's website.
I had to wait for a couple of moments more (30s) to see if my site could be accessed again.
Extra step: As James pointed out, you can edit the cronjob to output something instead of being discarded by dev/null
I am using Ubuntu server 20.04 and using IPv6 for hosting a webpage locally (as my ISP uses the same IPv4 for multiple customers). Everything works fine until my IP changes again - the script does not seem to work in CRON, and the duckdns website does not update my IP
When I check the crontab (I actually changed the ~/ to the full path, same result)
There you can find:
And checking cron log file:
You can see the cron is indeed running
Further details: I am using google to login in duckdns and token. I also checked the permissions to run the file:
Where you can find:
But when I run the script manually it all goes ok and online again
Then I see the duckdns successfully updated, and my website can be accessed by the name again. What gives?