ddns scripts updated

This commit is contained in:
2026-02-16 17:25:18 +08:00
parent 642522a01d
commit edac0e49c4
7 changed files with 26 additions and 0 deletions

1
scripts/ddns/afraid/.env Executable file
View File

@@ -0,0 +1 @@
AFRAID_TOKEN=6qfkK3VmHf7t4PwvTUJtxNEQ

25
scripts/ddns/afraid/update.sh Executable file
View File

@@ -0,0 +1,25 @@
#!/bin/bash
# shellcheck disable=SC1091
thisdir="$( dirname "$(readlink -e -- "${BASH_SOURCE[0]}")")"
log() {
timestamp="$(date +'%Y-%m-%d %H:%M:%S')"
datestamp="$(date +'%Y-%m-%d')"
[ ! -d "$thisdir/log" ] && mkdir "$thisdir/log"
echo "[$timestamp] $*" >> "$thisdir/log/$datestamp.log"
}
[ ! -f "$thisdir/.env" ] && {
log "ERROR: .env not exists"
exit 1
}
source "$thisdir/.env"
[ -z "$AFRAID_TOKEN" ] && {
log "ERROR: env var AFRAID_TOKEN not specified"
exit 1
}
result=$(curl -s "http://sync.afraid.org/u/${AFRAID_TOKEN}/")
log "$result"