The interesting about the code is that it always only treat the
timestamp of the file as "YYYY-MM-DD" and nothing else (this also
includes "now").

The code has functions for allowing the interval to be set down to 1s
but is does not mean anything to the outcome of the script as it always
looks for complete day(s).

I can only guess that the code might have has some old reference where
the script (or an other script) did something else.

As of the output of "date +%s" it is dependent of the timezone when used
with the --date command.

It kind of looks like the "date" is inputed in the local timezone rather
witch will make epoch time drift dependent of TZ.

# Bionic
$ TZ=UTC0 date --date="2020-01-01" +%s
1577836800
$ TZ=CET date --date="2020-01-01" +%s
1577833200

Using "date -u" will also fix this behaviour of date.

$ TZ=UTC date -u --date="2020-01-01" +%s
1577836800
$ TZ=CET date -u --date="2020-01-01" +%s
1577836800

An easy fix for the original problem would be add the "-u" option to the
date commands in the script:

stamp=$(date -u --date="$(date -r "$stamp_file" --iso-8601)" +%s 2>/dev/null)
now=$(date -u --date="$(date --iso-8601)" +%s 2>/dev/null)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1824088

Title:
  unattended upgrade ran one day after schedule

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1824088/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to