ddns scripts updated
This commit is contained in:
1
scripts/ddns/afraid/.env
Executable file
1
scripts/ddns/afraid/.env
Executable file
@@ -0,0 +1 @@
|
|||||||
|
AFRAID_TOKEN=6qfkK3VmHf7t4PwvTUJtxNEQ
|
||||||
25
scripts/ddns/afraid/update.sh
Executable file
25
scripts/ddns/afraid/update.sh
Executable 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"
|
||||||
Reference in New Issue
Block a user