mirror of https://github.com/samply/bridgehead.git
Merge pull request #102 from samply/fix/time-check
Fixed the Time Check
This commit is contained in:
commit
317e7bc017
|
@ -68,7 +68,7 @@ source /etc/bridgehead/${PROJECT}.conf
|
||||||
source ${PROJECT}/vars
|
source ${PROJECT}/vars
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
SERVERTIME="$(https_proxy=$HTTPS_PROXY_URL curl -m 5 -s -I $BROKER_URL 2>&1)"
|
SERVERTIME="$(https_proxy=$HTTPS_PROXY_URL curl -m 5 -s -I $BROKER_URL 2>&1 | grep -i -e '^Date: ' | sed -e 's/^Date: //i')"
|
||||||
RET=$?
|
RET=$?
|
||||||
set -e
|
set -e
|
||||||
if [ $RET -ne 0 ]; then
|
if [ $RET -ne 0 ]; then
|
||||||
|
@ -77,7 +77,6 @@ if [ $RET -ne 0 ]; then
|
||||||
else
|
else
|
||||||
log INFO "Checking clock skew ..."
|
log INFO "Checking clock skew ..."
|
||||||
|
|
||||||
SERVERTIME=$(echo -e "$SERVERTIME" | grep Date | sed -e 's/< Date: //')
|
|
||||||
SERVERTIME_AS_TIMESTAMP=$(date --date="$SERVERTIME" +%s)
|
SERVERTIME_AS_TIMESTAMP=$(date --date="$SERVERTIME" +%s)
|
||||||
MYTIME=$(date +%s)
|
MYTIME=$(date +%s)
|
||||||
SKEW=$(($SERVERTIME_AS_TIMESTAMP - $MYTIME))
|
SKEW=$(($SERVERTIME_AS_TIMESTAMP - $MYTIME))
|
||||||
|
|
Loading…
Reference in New Issue