File tree 4 files changed +57
-0
lines changed
4 files changed +57
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Configuration
2
+ nc-ddns.config.sh
Original file line number Diff line number Diff line change
1
+ # Namecheap Dynamic DNS Updater (Basic)
2
+
3
+ Just a simple * bash + cURL* based updater for the Namecheap Dynamic DNS service.
4
+ Works on macOS, probably Linux, and probably not Windows.
5
+
6
+ ## Configuration
7
+
8
+ * Make a copy of the example configuration file ` nc-ddns.config.example.sh ` and
9
+ name it ` nc-ddns.config.sh ` .
10
+ * Fill in the configuration values in that file from
11
+ Namecheap's web control panel:
12
+
13
+ ```
14
+ NC_DDNS_HOST=@
15
+ NC_DDNS_DOMAIN=mydomain.com
16
+ NC_DDNS_PASSWORD=ddns_password
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ```
22
+ $ ./nc-ddns.sh
23
+ ```
24
+
25
+ ## History
26
+
27
+ This updater was written as an alternative to the [ nc-ddns] updater,
28
+ because I couldn't get that updater to work.
29
+
30
+ [ nc-ddns ] : https://github.com/marcov/nc-ddns
Original file line number Diff line number Diff line change
1
+ NC_DDNS_HOST=@
2
+ NC_DDNS_DOMAIN=mydomain.com
3
+ NC_DDNS_PASSWORD=ddns_password
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ # Load configuration
4
+ source nc-ddns.config.sh
5
+
6
+ # Lookup my IP
7
+ MY_IP=$( curl -fsSL " icanhazip.com" )
8
+ if [ $? -ne 0 ]; then
9
+ echo " *** IP lookup failed. Is the IP lookup service offline?"
10
+ exit 1
11
+ fi
12
+
13
+ # Formulate URL to update my IP in Namecheap, based on documentation:
14
+ # https://www.namecheap.com/support/knowledgebase/article.aspx/29/11/how-do-i-use-a-browser-to-dynamically-update-the-hosts-ip/
15
+ UPDATE_URL=" https://dynamicdns.park-your-domain.com/update?host=${NC_DDNS_HOST} &domain=${NC_DDNS_DOMAIN} &password=${NC_DDNS_PASSWORD} &ip=${MY_IP} "
16
+
17
+ # Update my IP in Namecheap
18
+ STATUS_CODE=$( curl -o /dev/null -s -w " %{http_code}\n" " ${UPDATE_URL} " )
19
+ if [ $STATUS_CODE -ne 200 ]; then
20
+ echo " *** Update IP failed. Is the configuration wrong?"
21
+ exit 1
22
+ fi
You can’t perform that action at this time.
0 commit comments