26 lines
578 B
Bash
Executable File
26 lines
578 B
Bash
Executable File
#!/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"
|