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)
|
||||
BEFORE=$(date -d "$Y-$M-$D" '+%s')
|
||||
BACKWARDS_BETWEEN=0
|
||||
|
||||
# If the date was previously set
|
||||
if [[ -f "$BEFORE_DATE_FILE" ]]; then
|
||||
|
@ -1049,6 +1050,11 @@ if [[ -f "$BEFORE_DATE_FILE" ]]; then
|
|||
|
||||
# Try another time source
|
||||
TIMESOURCE=$TIMESOURCE2
|
||||
|
||||
# try running without any parameters
|
||||
tlsdate >> $LOGFILE
|
||||
|
||||
BACKWARDS_BETWEEN=1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -1084,8 +1090,13 @@ else
|
|||
fi
|
||||
|
||||
# Log the last date
|
||||
echo "$AFTER" > $BEFORE_DATE_FILE
|
||||
echo "$DATE_AFTER" > $BEFORE_FULLDATE_FILE
|
||||
if [ BACKWARDS_BETWEEN == 0 ]; then
|
||||
echo "$AFTER" > $BEFORE_DATE_FILE
|
||||
echo "$DATE_AFTER" > $BEFORE_FULLDATE_FILE
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
#+END_SRC
|
||||
|
||||
Save and exit.
|
||||
|
|
Loading…
Reference in New Issue