tlsdate script better treatment of backward timewarps
This commit is contained in:
parent
f32dda7801
commit
8a458860aa
|
@ -1031,6 +1031,7 @@ BEFORE_FULLDATE_FILE=/var/log/tlsdate.txt
|
||||||
|
|
||||||
DATE_BEFORE=$(date)
|
DATE_BEFORE=$(date)
|
||||||
BEFORE=$(date -d "$Y-$M-$D" '+%s')
|
BEFORE=$(date -d "$Y-$M-$D" '+%s')
|
||||||
|
BACKWARDS_BETWEEN=0
|
||||||
|
|
||||||
# If the date was previously set
|
# If the date was previously set
|
||||||
if [[ -f "$BEFORE_DATE_FILE" ]]; then
|
if [[ -f "$BEFORE_DATE_FILE" ]]; then
|
||||||
|
@ -1049,6 +1050,11 @@ if [[ -f "$BEFORE_DATE_FILE" ]]; then
|
||||||
|
|
||||||
# Try another time source
|
# Try another time source
|
||||||
TIMESOURCE=$TIMESOURCE2
|
TIMESOURCE=$TIMESOURCE2
|
||||||
|
|
||||||
|
# try running without any parameters
|
||||||
|
tlsdate >> $LOGFILE
|
||||||
|
|
||||||
|
BACKWARDS_BETWEEN=1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1084,8 +1090,13 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Log the last date
|
# Log the last date
|
||||||
|
if [ BACKWARDS_BETWEEN == 0 ]; then
|
||||||
echo "$AFTER" > $BEFORE_DATE_FILE
|
echo "$AFTER" > $BEFORE_DATE_FILE
|
||||||
echo "$DATE_AFTER" > $BEFORE_FULLDATE_FILE
|
echo "$DATE_AFTER" > $BEFORE_FULLDATE_FILE
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
Save and exit.
|
Save and exit.
|
||||||
|
|
Loading…
Reference in New Issue