Check that the previous date was a number
This commit is contained in:
parent
605a394dfb
commit
97c23d9686
|
@ -4776,24 +4776,27 @@ function time_synchronisation {
|
|||
echo 'DATE_BEFORE=$(date)' >> /usr/bin/updatedate
|
||||
echo 'BEFORE=$(date "+%s")' >> /usr/bin/updatedate
|
||||
echo 'BACKWARDS_BETWEEN=0' >> /usr/bin/updatedate
|
||||
echo 're="^[0-9]+$"' >> /usr/bin/updatedate
|
||||
echo '# If the date was previously set' >> /usr/bin/updatedate
|
||||
echo 'if [ -s "$BEFORE_DATE_FILE" ]; then' >> /usr/bin/updatedate
|
||||
echo ' filesize=$(wc -c "$BEFORE_DATE_FILE" | cut -f 1 -d " ")' >> /usr/bin/updatedate
|
||||
echo ' if [ $filesize -ge 5 ]; 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
|
||||
echo ' if (( $BEFORE_FILE > $BEFORE )); then' >> /usr/bin/updatedate
|
||||
echo ' echo -n "Date went backwards between tlsdate updates. " >> $LOGFILE' >> /usr/bin/updatedate
|
||||
echo ' echo -n "$BEFORE_FILE > $BEFORE, " >> $LOGFILE' >> /usr/bin/updatedate
|
||||
echo ' echo "$BEFORE_FULLDATE > $DATE_BEFORE" >> $LOGFILE' >> /usr/bin/updatedate
|
||||
echo ' # Send a warning email' >> /usr/bin/updatedate
|
||||
echo ' echo $(tail $LOGFILE -n 2) | mail -s "tlsdate anomaly" $EMAIL' >> /usr/bin/updatedate
|
||||
echo ' # Try another time source' >> /usr/bin/updatedate
|
||||
echo ' TIMESOURCE=$TIMESOURCE2' >> /usr/bin/updatedate
|
||||
echo ' # try running without any parameters' >> /usr/bin/updatedate
|
||||
echo ' tlsdate >> $LOGFILE' >> /usr/bin/updatedate
|
||||
echo ' BACKWARDS_BETWEEN=1' >> /usr/bin/updatedate
|
||||
echo ' if [[ $BEFORE_FILE =~ $re ]] ; then' >> /usr/bin/updatedate
|
||||
echo ' BEFORE_FULLDATE=$(cat $BEFORE_FULLDATE_FILE)' >> /usr/bin/updatedate
|
||||
echo ' # is the date going backwards?' >> /usr/bin/updatedate
|
||||
echo ' if (( $BEFORE_FILE > $BEFORE )); then' >> /usr/bin/updatedate
|
||||
echo ' echo -n "Date went backwards between tlsdate updates. " >> $LOGFILE' >> /usr/bin/updatedate
|
||||
echo ' echo -n "$BEFORE_FILE > $BEFORE, " >> $LOGFILE' >> /usr/bin/updatedate
|
||||
echo ' echo "$BEFORE_FULLDATE > $DATE_BEFORE" >> $LOGFILE' >> /usr/bin/updatedate
|
||||
echo ' # Send a warning email' >> /usr/bin/updatedate
|
||||
echo ' echo $(tail $LOGFILE -n 2) | mail -s "tlsdate anomaly" $EMAIL' >> /usr/bin/updatedate
|
||||
echo ' # Try another time source' >> /usr/bin/updatedate
|
||||
echo ' TIMESOURCE=$TIMESOURCE2' >> /usr/bin/updatedate
|
||||
echo ' # try running without any parameters' >> /usr/bin/updatedate
|
||||
echo ' tlsdate >> $LOGFILE' >> /usr/bin/updatedate
|
||||
echo ' BACKWARDS_BETWEEN=1' >> /usr/bin/updatedate
|
||||
echo ' fi' >> /usr/bin/updatedate
|
||||
echo ' fi' >> /usr/bin/updatedate
|
||||
echo ' fi' >> /usr/bin/updatedate
|
||||
echo 'fi' >> /usr/bin/updatedate
|
||||
|
|
Loading…
Reference in New Issue