duckdns
This commit is contained in:
3
tools/duckdns/.env.example
Normal file
3
tools/duckdns/.env.example
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
DUCK_TOKEN=
|
||||||
|
DUCK_DOMAINS=
|
||||||
|
DUCK_IP=
|
||||||
1
tools/duckdns/.gitignore
vendored
Normal file
1
tools/duckdns/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.env
|
||||||
22
tools/duckdns/install.sh
Executable file
22
tools/duckdns/install.sh
Executable file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# https://www.duckdns.org/install.jsp
|
||||||
|
|
||||||
|
thisdir="$( dirname "$(readlink -e -- "${BASH_SOURCE[0]}")")"
|
||||||
|
|
||||||
|
cp -f .env.example .env
|
||||||
|
|
||||||
|
cat <<EOF | sudo tee /etc/cron.d/duckdns && crontab -u "$(whoami)" /etc/cron.d/duckdns
|
||||||
|
# ------------- Minute (0 - 59)
|
||||||
|
# | ----------- Hour (0 - 23)
|
||||||
|
# | | --------- Day of month (1 - 31)
|
||||||
|
# | | | ------- Month (1 - 12)
|
||||||
|
# | | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
|
||||||
|
# | | | | |
|
||||||
|
# * * * * * "command to be executed"
|
||||||
|
|
||||||
|
# AAA обновление duckdns ip
|
||||||
|
0 * * * * $thisdir/update.sh
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
3
tools/duckdns/uninstall.sh
Executable file
3
tools/duckdns/uninstall.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
sudo rm -f /etc/cron.d/duckdns
|
||||||
21
tools/duckdns/update.sh
Executable file
21
tools/duckdns/update.sh
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# shellcheck disable=SC1091
|
||||||
|
|
||||||
|
[ ! -f .env ] && {
|
||||||
|
echo "ERROR: .env not exists"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
source .env
|
||||||
|
|
||||||
|
[ -z "$DUCK_TOKEN" ] && {
|
||||||
|
echo "ERROR: env var DUCK_TOKEN not specified"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
[ -z "$DUCK_DOMAINS" ] && {
|
||||||
|
echo "ERROR: env var DUCK_DOMAINS not specified"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
curl -k "https://www.duckdns.org/update?domains=${DUCK_DOMAINS}&token=${DUCK_TOKEN}&ip=${DUCK_IP}"
|
||||||
Reference in New Issue
Block a user