Linux Labs

Inside the system: resources, kernel, processes / Stage 11 of 12

Time, time zone and synchronisation

Not running Starting usually ~20 s
Leave the lesson

Step 1 of 7 · on a machine · 4 min

The export arrives at noon

What you will learn

  • Tell the time in the machine's clock from the time zone and read both in timedatectl.
  • Schedule a cron job by the machine's zone and know what a TZ= line in the schedule changes.
  • Read clock synchronisation in chronyc sources and chronyc tracking and align the clock with a time server.

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.

Exercise · look

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.

Sign in and start The machine is available after signing in
Check yourself 1 question

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.

  • date and 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.

Ubuntu 24.04
Loading…