Fix date checking
This commit is contained in:
parent
e1e8b3772c
commit
b8510b4bfc
|
@ -4774,10 +4774,10 @@ function time_synchronisation {
|
|||
echo '# File which contains the previous date as a string' >> /usr/bin/updatedate
|
||||
echo 'BEFORE_FULLDATE_FILE=/var/log/tlsdate.txt' >> /usr/bin/updatedate
|
||||
echo 'DATE_BEFORE=$(date)' >> /usr/bin/updatedate
|
||||
echo 'BEFORE=$(date -d "$Y-$M-$D" "+%s")' >> /usr/bin/updatedate
|
||||
echo 'BEFORE=$(date +%Y-%M-%D)' >> /usr/bin/updatedate
|
||||
echo 'BACKWARDS_BETWEEN=0' >> /usr/bin/updatedate
|
||||
echo '# If the date was previously set' >> /usr/bin/updatedate
|
||||
echo 'if [ -f "$BEFORE_DATE_FILE" ]; then' >> /usr/bin/updatedate
|
||||
echo 'if [ -s "$BEFORE_DATE_FILE" ]; then' >> /usr/bin/updatedate
|
||||
echo ' BEFORE_FILE=$(cat $BEFORE_DATE_FILE)' >> /usr/bin/updatedate
|
||||
echo ' BEFORE_FULLDATE=$(cat $BEFORE_FULLDATE_FILE)' >> /usr/bin/updatedate
|
||||
echo ' # is the date going backwards?' >> /usr/bin/updatedate
|
||||
|
@ -4797,7 +4797,7 @@ function time_synchronisation {
|
|||
echo '# Set the date' >> /usr/bin/updatedate
|
||||
echo '/usr/bin/timeout $TIMEOUT tlsdate -l -t -H $TIMESOURCE -p 443 >> $LOGFILE' >> /usr/bin/updatedate
|
||||
echo 'DATE_AFTER=$(date)' >> /usr/bin/updatedate
|
||||
echo 'AFTER=$(date -d "$Y-$M-$D" '+%s')' >> /usr/bin/updatedate
|
||||
echo 'AFTER=$(date +%Y-%M-%D)' >> /usr/bin/updatedate
|
||||
echo '# After setting the date did it go backwards?' >> /usr/bin/updatedate
|
||||
echo 'if (( $AFTER < $BEFORE )); then' >> /usr/bin/updatedate
|
||||
echo ' echo "Incorrect date: $DATE_BEFORE -> $DATE_AFTER" >> $LOGFILE' >> /usr/bin/updatedate
|
||||
|
@ -4806,10 +4806,10 @@ function time_synchronisation {
|
|||
echo ' # Try resetting the date from another time source' >> /usr/bin/updatedate
|
||||
echo ' /usr/bin/timeout $TIMEOUT tlsdate -l -t -H $TIMESOURCE2 -p 443 >> $LOGFILE' >> /usr/bin/updatedate
|
||||
echo ' DATE_AFTER=$(date)' >> /usr/bin/updatedate
|
||||
echo ' AFTER=$(date -d "$Y-$M-$D" "+%s")' >> /usr/bin/updatedate
|
||||
echo ' AFTER=$(date +%Y-%M-%D)' >> /usr/bin/updatedate
|
||||
echo 'else' >> /usr/bin/updatedate
|
||||
echo ' echo -n $TIMESOURCE >> $LOGFILE' >> /usr/bin/updatedate
|
||||
echo ' if [ -f "$BEFORE_DATE_FILE" ]; then' >> /usr/bin/updatedate
|
||||
echo ' if [ -s "$BEFORE_DATE_FILE" ]; then' >> /usr/bin/updatedate
|
||||
echo ' echo -n " " >> $LOGFILE' >> /usr/bin/updatedate
|
||||
echo ' echo -n $BEFORE_FILE >> $LOGFILE' >> /usr/bin/updatedate
|
||||
echo ' fi' >> /usr/bin/updatedate
|
||||
|
|
Loading…
Reference in New Issue