Accounting expects the orders export by nine in the morning Moscow time, but the file only arrives at noon. A colleague insists the schedule says nine o'clock and the Moscow zone. Look at the export's schedule, its log and the machine's clock.
Look at the export
The lab-export orders export is supposed to run at 9:00 Moscow time. Look at its schedule in /etc/cron.d/lab-export, at the last lines of its log /var/log/lab-export.log and at the machine's clock.
First, predict
The schedule says 9 o'clock and has a TZ=Europe/Moscow line. At what Moscow time did the export run in the last few days, judging by its log?
Now start the exercise, run the command and compare your prediction with the output.
The export is set for 9:00, its log says 12:00:01 MSK, and date shows the time in UTC. What follows from this?
-
cron starts a job in the minute set in the schedule: the log says 12:00:01, one second into the minute.
-
cron did read the line: the time in the export log is MSK, so its job got TZ=Europe/Moscow.
-
dateand the log show one moment in different zones: MSK is UTC+3. The machine's clock itself is right.
cron ran the export at 9:00 UTC — that is 12:00 in Moscow.