Skip to content

Commit fbb9f27

Browse files
authored
Merge pull request #298 from senarvi/duckdns-random-delay
Add a random delay before duckdns request
2 parents 34850c1 + b53f70c commit fbb9f27

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

docs/Accessing-your-Device-from-the-internet.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ first test the script to make sure it works `sudo ~/IOTstack/duck/duck.sh` then
1717
Create a cron job by running the following command `crontab -e`
1818

1919
You will be asked to use an editor option 1 for nano should be fine
20-
paste the following in the editor `*/5 * * * * sudo ~/IOTstack/duck/duck.sh >/dev/null 2>&1` then ctrl+s and ctrl+x to save
20+
paste the following in the editor `*/5 * * * * ~/IOTstack/duck/duck.sh` then ctrl+s and ctrl+x to save
2121

2222
Your Public IP should be updated every five minutes
2323

duck/duck.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@
33
DOMAINS="YOUR_DOMAINS"
44
# Your DuckDNS Token
55
DUCKDNS_TOKEN="YOUR_DUCKDNS_TOKEN"
6-
curl -k -o /var/log/duck.log "https://www.duckdns.org/update?domains=${DOMAINS}&token=${DUCKDNS_TOKEN}&ip="
6+
7+
# A random delay to avoid every client contacting the duckdns server at the same moment
8+
sleep $((RANDOM % 60))
9+
# Request duckdns to update your domain name with your public IP address
10+
curl --silent --max-time 10 --output /dev/null "https://www.duckdns.org/update?domains=${DOMAINS}&token=${DUCKDNS_TOKEN}&ip="

0 commit comments

Comments
 (0)