Update usr/local/bin/pingfinder.sh
This commit is contained in:
parent
71b20e1a0f
commit
be942ccbbc
1 changed files with 0 additions and 24 deletions
|
@ -14,12 +14,6 @@
|
|||
UUID=${UUID}
|
||||
PEERFINDER=${PEERFINDER:-"https://dn42.us/peers"}
|
||||
NB_PINGS=${NB_PINGS:-5}
|
||||
LOGFILE=${LOGFILE:-/dev/stdout} # Set to /dev/null to only receive errors.
|
||||
# Set to a file writable by the cron runner to record pings.
|
||||
# (Errors will be sent in cron mail)
|
||||
WARNLOCK=${WARNLOCK:-warn.lock} # Set this variable if you want a file written when the script updates.
|
||||
LOCKFILE=${LOCKFILE:-exec.lock} # Set this variable if you want the script to not run multiple instances at once.
|
||||
LOCKFD=${LOCKFD:-42}
|
||||
|
||||
# This avoids synchronisation (everybody fetching jobs and running
|
||||
# measurements simultaneously)
|
||||
|
@ -33,18 +27,11 @@ function die() {
|
|||
exit 1
|
||||
}
|
||||
|
||||
eval "exec $LOCKFD>$LOCKFILE"
|
||||
|
||||
flock -n "$LOCKFD" || die "Unable to acquire lock."
|
||||
|
||||
VERSION=1.2.1
|
||||
# shellcheck disable=SC2046 # Intended splitting of VERSION
|
||||
# shellcheck disable=SC2183 #
|
||||
ver() { printf "%03d%03d%03d%03d" $(echo "$1" | tr '.' ' '); }
|
||||
|
||||
[ -e "$LOGFILE" ] || touch "$LOGFILE"
|
||||
exec >> "$LOGFILE"
|
||||
|
||||
echo "STARTING PEERFINDER (v. $VERSION)"
|
||||
|
||||
# check for IPv4 binary
|
||||
|
@ -69,20 +56,9 @@ while true ; do
|
|||
REQ_ID=$(grep REQ_ID "$JOB"|cut -d'=' -f2|tr -d '[$`;><{}%|&!()]"\\/')
|
||||
REQ_IP=$(grep REQ_IP "$JOB"|cut -d'=' -f2|tr -d '[$`;><{}%|&!()]"\\/')
|
||||
REQ_FAMILY=$(grep REQ_FAMILY "$JOB"|cut -d'=' -f2|tr -d '[$`;><{}%|&!()]"\\/')
|
||||
CUR_VERSION=$(grep SCRIPT_VERSION "$JOB"|cut -d'=' -f2|tr -d '[$`;><{}%|&!()]"\\/')
|
||||
|
||||
rm "$JOB"
|
||||
|
||||
if [ "$(ver "$VERSION")" -lt "$(ver "$CUR_VERSION")" ]; then
|
||||
echo "## PEERFINDER WARN $(date) ## " \
|
||||
"Current script version is $CUR_VERSION. You are running $VERSION " \
|
||||
"Get it here: https://dn42.us/peers/script"
|
||||
|
||||
[ -z "$WARNLOCK" ] && touch "$WARNLOCK"
|
||||
else
|
||||
[ -z "$WARNLOCK" ] || [ -f "$WARNLOCK" ] && rm "$WARNLOCK"
|
||||
fi
|
||||
|
||||
# Avoid empty fields
|
||||
[ -z "$REQ_ID" ] && [ -z "$REQ_IP" ] && exit
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue