ServerHandbook live check: run log ------------------------------------------------------------------------------ Article https://serverhandbook.com/kb/timezone-ubuntu Check scripts/live/checks/timezone-ubuntu.mjs (sha256 fd1c12c4a3efa745582ccf1482d8b68863c751eaea19ab1425da7a0524c085a0) Ran at 2026-11-18T11:56:54Z (331 s) Result PASS, all 35 claims held Tested on System Ubuntu 26.04.1 LTS Kernel 7.0.0-43-generic Package systemd 259.9-0ubuntu0.1 Package tzdata 2026e-0ubuntu0.26.04.1 Package cron 3.0pl1-200ubuntu1 Package rsyslog 8.2512.0-1ubuntu4.2 Setup A fresh Ubuntu 26.04 server from Ubuntu’s cloud image, on UTC as a provider hands it over, reached over SSH as a sudo user. Every version above was read from the server at run time. Passwords used on the throwaway test server are shown as [password]. How we test: https://serverhandbook.com/how-we-test ------------------------------------------------------------------------------ What the steps changed on the server (recorded before the first step and after the last) Packages added (0) Packages upgraded (0) Packages removed (0) Services enabled at boot (0) Services disabled (0) Listening sockets opened (0) Listening sockets closed (0) Files added in /etc (0) Files changed in /etc (1) /etc/localtime Files removed from /etc (0) Disk used on / (includes logs written during the run): +0.5 MB ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Check-your-server script (2 items): https://cdn.serverhandbook.com/check/timezone-ubuntu/ubuntu-26.04.1-20261118t115654z.sh SHA-256 822bcb6b0df5d547c2f87bc0ff72fcf5723aa868ac019e9ad626f1aac8c25a63 ------------------------------------------------------------------------------ On the stock server, before the first step: FAIL the time zone is set (not the default UTC; skip this line if you want UTC) PASS the clock is synchronized After the last step: PASS the time zone is set (not the default UTC; skip this line if you want UTC) PASS the clock is synchronized ------------------------------------------------------------------------------ Claims (35), each with what the run saw ------------------------------------------------------------------------------ 1. ok a bare Ubuntu 26.04 server box (web-server) starts 2. ok a fresh cloud server is on UTC: "Time zone: Etc/UTC (UTC, +0000)" | Local time: Wed 2026-11-18 11:57:44 UTC | Universal time: Wed 2026-11-18 11:57:44 UTC | RTC time: Wed 2026-11-18 11:57:44 | Time zone: Etc/UTC (UTC, +0000) | System clock synchronized: yes | NTP service: active | RTC in local TZ: no 3. ok …and its clock is kept right by NTP: "System clock synchronized: yes", "NTP service: active" | Local time: Wed 2026-11-18 11:57:44 UTC | Universal time: Wed 2026-11-18 11:57:44 UTC | RTC time: Wed 2026-11-18 11:57:44 | Time zone: Etc/UTC (UTC, +0000) | System clock synchronized: yes | NTP service: active | RTC in local TZ: no 4. ok grep finds the exact name America/New_York | America/New_York 5. ok the list has several hundred names | 485 6. ok set-timezone prints nothing when it works 7. ok timedatectl now shows "Time zone: America/New_York" with its offset from UTC | Local time: Wed 2026-11-18 06:57:50 EST | Universal time: Wed 2026-11-18 11:57:50 UTC | RTC time: Wed 2026-11-18 11:57:50 | Time zone: America/New_York (EST, -0500) | System clock synchronized: yes | NTP service: active | RTC in local TZ: no 8. ok …Universal time is unchanged: only the way the time is shown changed | Local time: Wed 2026-11-18 06:57:50 EST | Universal time: Wed 2026-11-18 11:57:50 UTC | RTC time: Wed 2026-11-18 11:57:50 | Time zone: America/New_York (EST, -0500) | System clock synchronized: yes | NTP service: active | RTC in local TZ: no 9. ok date shows the New York time and zone | Wed Nov 18 06:57:51 EST 2026 10. ok the change is one symlink: /etc/localtime → /usr/share/zoneinfo/America/New_York | lrwxrwxrwx 1 root root 38 Nov 18 06:57 /etc/localtime -> ../usr/share/zoneinfo/America/New_York 11. ok a misspelt name: "Failed to set time zone: Invalid or not installed time zone" | Failed to set time zone: Invalid or not installed time zone 'America/New_Yrok' 12. ok (cron was started before the change and has not been restarted) | 21337756 | > 13. ok crontab -l shows the test job | 59 6 * * * date > ~/cron-test.txt 14. ok cron ran the job at that New York time, without a restart | 06:59 → Wed Nov 18 06:59:01 EST 2026 15. ok systemd timers follow too: the automatic-update timer (OnCalendar 6:00) is now due at 06:xx New York time | NEXT LEFT LAST PASSED UNIT ACTIVATES | Thu 2026-11-19 06:20:00 EST 23h - - apt-daily-upgrade.timer apt-daily-upgrade.service | | 1 timers listed. | Pass --all to see loaded but inactive timers, too. 16. ok journalctl shows the change: "Changed time zone to 'America/New_York'" | Nov 18 06:57:49 web-server systemd-timedated[1416]: Changed time zone to 'America/New_York' (EDT). 17. ok (the log line names the zone's SUMMER abbreviation, EDT, even in winter: timedated.c prints tzname[daylight]) | Nov 18 06:57:49 web-server systemd-timedated[1416]: Changed time zone to 'America/New_York' (EDT). 18. ok (hidden) a program started before the change still prints UTC times | 11:59:07 UTC | 11:59:09 UTC 19. ok /var/log/syslog still stamps new lines with +00:00 (rsyslog started on UTC) | 2026-11-18T11:59:13.344362+00:00 web-server deploy: zone test 1 20. ok restarting rsyslog prints nothing 21. ok after the restart new lines carry the New York offset (-05:00 or -04:00) | 2026-11-18T11:59:13.344362+00:00 web-server deploy: zone test 1 | 2026-11-18T06:59:15.854894-05:00 web-server deploy: zone test 2 22. ok there is no /etc/timezone on Ubuntu 26.04 | cat: /etc/timezone: No such file or directory 23. ok dpkg-reconfigure tzdata reads the zone from /etc/localtime: "Current default time zone: 'America/New_York'" | Current default time zone: 'America/New_York' | Local time is now: Wed Nov 18 06:59:18 EST 2026. | Universal Time is now: Wed Nov 18 11:59:18 UTC 2026. 24. ok dpkg-reconfigure tzdata does not create /etc/timezone either | cat: /etc/timezone: No such file or directory 25. ok the server comes back after the reboot | 30 26. ok after the reboot the zone is still America/New_York and the clock synchronized | Local time: Wed 2026-11-18 06:59:56 EST | Universal time: Wed 2026-11-18 11:59:56 UTC | RTC time: Wed 2026-11-18 11:59:56 | Time zone: America/New_York (EST, -0500) | System clock synchronized: yes | NTP service: active | RTC in local TZ: no 27. ok (after the reboot syslog lines carry the New York offset with no restart) | 2026-11-18T06:59:57.411639-05:00 web-server deploy: zone test 3 28. ok TZ=Asia/Tokyo date shows Tokyo time for that one command | Wed Nov 18 20:59:59 JST 2026 29. ok …and the server zone is unchanged | Wed Nov 18 07:00:01 EST 2026 30. ok a systemd timer can name its own zone: systemd-analyze shows when 09:00 Tokyo falls in server time | Original form: *-*-* 09:00 Asia/Tokyo | Normalized form: *-*-* 09:00:00 Asia/Tokyo | Next elapse: Wed 2026-11-18 19:00:00 EST | (in UTC): Thu 2026-11-19 00:00:00 UTC | From now: 11h left 31. ok (hidden) CRON_TZ=UTC is ignored: a job at UTC+2 min never ran, while the control job beside it did | 12:02 UTC / control Wed Nov 18 07:02:01 EST 2026 32. ok (the clock is synchronized) | yes 33. ok (tested on) the box reports its OS, kernel and the version of 4 package(s) | PRETTY_NAME="Ubuntu 26.04.1 LTS" | VIRT=none | KERNEL=7.0.0-43-generic | PKG cron 3.0pl1-200ubuntu1 | PKG rsyslog 8.2512.0-1ubuntu4.2 | PKG systemd 259.9-0ubuntu0.1 | PKG tzdata 2026e-0ubuntu0.26.04.1 34. ok after the undo the server is back on "Etc/UTC (UTC, +0000)" | Local time: Wed 2026-11-18 12:02:23 UTC | Universal time: Wed 2026-11-18 12:02:23 UTC | RTC time: Wed 2026-11-18 12:02:23 | Time zone: Etc/UTC (UTC, +0000) | System clock synchronized: yes | NTP service: active | RTC in local TZ: no 35. ok (/etc/localtime and /etc/timezone are back to Etc/UTC) | lrwxrwxrwx 1 root root 29 Nov 18 12:02 /etc/localtime -> ../usr/share/zoneinfo/Etc/UTC | cat: /etc/timezone: No such file or directory ------------------------------------------------------------------------------ Commands and what they printed (28) ------------------------------------------------------------------------------ $ timedatectl Local time: Wed 2026-11-18 11:57:44 UTC Universal time: Wed 2026-11-18 11:57:44 UTC RTC time: Wed 2026-11-18 11:57:44 Time zone: Etc/UTC (UTC, +0000) System clock synchronized: yes NTP service: active RTC in local TZ: no $ timedatectl list-timezones | grep -i york America/New_York $ timedatectl list-timezones | wc -l 485 $ sudo timedatectl set-timezone America/New_York $ timedatectl Local time: Wed 2026-11-18 06:57:50 EST Universal time: Wed 2026-11-18 11:57:50 UTC RTC time: Wed 2026-11-18 11:57:50 Time zone: America/New_York (EST, -0500) System clock synchronized: yes NTP service: active RTC in local TZ: no $ date Wed Nov 18 06:57:51 EST 2026 $ ls -l /etc/localtime lrwxrwxrwx 1 root root 38 Nov 18 06:57 /etc/localtime -> ../usr/share/zoneinfo/America/New_York $ sudo timedatectl set-timezone America/New_Yrok Failed to set time zone: Invalid or not installed time zone 'America/New_Yrok' $ crontab -l 59 6 * * * date > ~/cron-test.txt $ cat ~/cron-test.txt Wed Nov 18 06:59:01 EST 2026 $ systemctl list-timers apt-daily-upgrade.timer --no-pager NEXT LEFT LAST PASSED UNIT ACTIVATES Thu 2026-11-19 06:20:00 EST 23h - - apt-daily-upgrade.timer apt-daily-upgrade.service 1 timers listed. Pass --all to see loaded but inactive timers, too. $ sudo journalctl -q -t systemd-timedated --no-pager Nov 18 06:57:49 web-server systemd-timedated[1416]: Changed time zone to 'America/New_York' (EDT). $ logger 'zone test 1' $ sudo grep 'zone test' /var/log/syslog 2026-11-18T11:59:13.344362+00:00 web-server deploy: zone test 1 $ sudo systemctl restart rsyslog $ logger 'zone test 2' $ sudo grep 'zone test' /var/log/syslog 2026-11-18T11:59:13.344362+00:00 web-server deploy: zone test 1 2026-11-18T06:59:15.854894-05:00 web-server deploy: zone test 2 $ cat /etc/timezone cat: /etc/timezone: No such file or directory $ sudo dpkg-reconfigure -f noninteractive tzdata Current default time zone: 'America/New_York' Local time is now: Wed Nov 18 06:59:18 EST 2026. Universal Time is now: Wed Nov 18 11:59:18 UTC 2026. $ cat /etc/timezone cat: /etc/timezone: No such file or directory $ sudo reboot $ timedatectl Local time: Wed 2026-11-18 06:59:56 EST Universal time: Wed 2026-11-18 11:59:56 UTC RTC time: Wed 2026-11-18 11:59:56 Time zone: America/New_York (EST, -0500) System clock synchronized: yes NTP service: active RTC in local TZ: no $ TZ=Asia/Tokyo date Wed Nov 18 20:59:59 JST 2026 $ systemd-analyze calendar '*-*-* 09:00 Asia/Tokyo' Original form: *-*-* 09:00 Asia/Tokyo Normalized form: *-*-* 09:00:00 Asia/Tokyo Next elapse: Wed 2026-11-18 19:00:00 EST (in UTC): Thu 2026-11-19 00:00:00 UTC From now: 11h left $ sudo timedatectl set-timezone Etc/UTC $ sudo dpkg-reconfigure -f noninteractive tzdata Current default time zone: 'Etc/UTC' Local time is now: Wed Nov 18 12:02:21 UTC 2026. Universal Time is now: Wed Nov 18 12:02:21 UTC 2026. $ sudo systemctl restart rsyslog $ timedatectl Local time: Wed 2026-11-18 12:02:23 UTC Universal time: Wed 2026-11-18 12:02:23 UTC RTC time: Wed 2026-11-18 12:02:23 Time zone: Etc/UTC (UTC, +0000) System clock synchronized: yes NTP service: active RTC in local TZ: no ------------------------------------------------------------------------------ The check-your-server script, its full screen before the steps ------------------------------------------------------------------------------ ServerHandbook check, timezone-ubuntu (proved 2026-11-18) FAIL the time zone is set (not the default UTC; skip this line if you want UTC) fix: https://serverhandbook.com/kb/timezone-ubuntu#step-3-set PASS the clock is synchronized 1 passed, 1 failed To fix a FAIL, follow the steps in https://serverhandbook.com/kb/timezone-ubuntu ------------------------------------------------------------------------------ The check-your-server script, its full screen after the steps ------------------------------------------------------------------------------ ServerHandbook check, timezone-ubuntu (proved 2026-11-18) PASS the time zone is set (not the default UTC; skip this line if you want UTC) PASS the clock is synchronized 2 passed, 0 failed ------------------------------------------------------------------------------ The check's source (scripts/live/checks/timezone-ubuntu.mjs) As it ran. ------------------------------------------------------------------------------ /** * KB: Set the timezone on Ubuntu 26.04 and 24.04 (run per release, --releases=26.04,24.04): check it, find the zone name, set it, what follows the change at once (cron, * systemd timers, journalctl) and what keeps the old zone (/var/log/syslog until rsyslog restarts, programs already * running, /etc/timezone), reboot, one job in another zone, undo. * * The server is a fresh VM box from Ubuntu's cloud image, reached as the sudo user `deploy`. It starts on Etc/UTC, as * every cloud server does. "cron follows the new zone without a restart" is proved with a real job set two minutes * ahead in the NEW zone while cron was started before the change; "CRON_TZ is ignored" with a control job beside it; * "a running program keeps the old zone" with a hidden loop started before the change. Every claim is one the * article makes. */ import { rebootBox } from '../box.mjs' import { bareBox, reportBox } from '../lib.mjs' export const meta = { // The reader's check-your-server script (plan05 phase 3): proved by the runner on the stock server and after the steps. reader: [ { item: "the time zone is set (not the default UTC; skip this line if you want UTC)", cmd: "timedatectl show -p Timezone --value", expect: "^(?!(Etc/)?UTC$)\\S+$", step: "step-3-set" }, { item: "the clock is synchronized", cmd: "timedatectl show -p NTPSynchronized --value", expect: "^yes$", step: "step-1-check" }, ], } const RELEASE = process.env.LIVE_BOX_RELEASE || '24.04' const ZONE = 'America/New_York' /** EST in winter, EDT in summer: the run's date decides, never the check. */ const NY = /\bE[SD]T\b/ /** timesyncd's first contact takes a few seconds after a boot; a reader logs in later than our runner does. */ const waitSync = (L) => L('for i in $(seq 90); do [ "$(timedatectl show -p NTPSynchronized --value)" = yes ] && break; sleep 2; done', 240000) const waitFor = (L, file, secs) => L(`for i in $(seq ${secs}); do [ -f ${file} ] && break; sleep 1; done; cat ${file} 2>/dev/null`, (secs + 30) * 1000) const check = (ctx) => bareBox(ctx, async ({ sudoUser }) => { const { run, L } = sudoUser() L('sudo true') // a reader has used sudo before (earlier articles), so Ubuntu's first-sudo hint is not on their screen // ── step 1: what it is now ─────────────────────────────────────────────────────────────── waitSync(L) const st0 = run('timedatectl', { id: 'status-before' }) ctx.check('a fresh cloud server is on UTC: "Time zone: Etc/UTC (UTC, +0000)"', /Time zone: Etc\/UTC \(UTC, \+0000\)/.test(st0.out), st0.out) ctx.check('…and its clock is kept right by NTP: "System clock synchronized: yes", "NTP service: active"', /System clock synchronized: yes/.test(st0.out) && /NTP service: active/.test(st0.out), st0.out) // ── step 2: find the name ──────────────────────────────────────────────────────────────── const find = run('timedatectl list-timezones | grep -i york', { id: 'find' }) ctx.check(`grep finds the exact name ${ZONE}`, find.out === ZONE, find.out) const count = run('timedatectl list-timezones | wc -l', { id: 'count' }) ctx.check('the list has several hundred names', Number(count.out) > 300, count.out) // a program already running before the change (hidden): prints the time every 2 s L(`nohup python3 -c " import time while True: open('/tmp/clock.txt', 'a').write(time.strftime('%H:%M:%S %Z') + '\\n'); time.sleep(2) " >/dev/null 2>&1 &`) const cronStart = L('systemctl show cron -p ActiveEnterTimestampMonotonic --value') // ── step 3: set it ─────────────────────────────────────────────────────────────────────── const set = run(`sudo timedatectl set-timezone ${ZONE}`, { id: 'set' }) ctx.check('set-timezone prints nothing when it works', set.exit === 0 && set.out === '', set.out) const st1 = run('timedatectl', { id: 'status-after' }) ctx.check(`timedatectl now shows "Time zone: ${ZONE}" with its offset from UTC`, new RegExp(`Time zone: ${ZONE} \\(E[SD]T, -0[45]00\\)`).test(st1.out), st1.out) ctx.check('…Universal time is unchanged: only the way the time is shown changed', /Universal time: .* UTC/.test(st1.out), st1.out) const date = run('date', { id: 'date' }) ctx.check('date shows the New York time and zone', NY.test(date.out), date.out) const link = run('ls -l /etc/localtime', { id: 'localtime' }) ctx.check('the change is one symlink: /etc/localtime → /usr/share/zoneinfo/America/New_York', new RegExp(`/etc/localtime -> (\\.\\.)?/usr/share/zoneinfo/${ZONE}$`).test(link.out), link.out) const typo = run('sudo timedatectl set-timezone America/New_Yrok', { id: 'typo' }) ctx.check('a misspelt name: "Failed to set time zone: Invalid or not installed time zone"', typo.exit !== 0 && typo.out === "Failed to set time zone: Invalid or not installed time zone 'America/New_Yrok'", typo.out) // ── step 4: what follows at once ───────────────────────────────────────────────────────── // cron: a job two minutes ahead in the NEW zone (the reader adds it with crontab -e) ctx.check('(cron was started before the change and has not been restarted)', cronStart !== '' && L('systemctl show cron -p ActiveEnterTimestampMonotonic --value') === cronStart, cronStart) const [mm, hh] = L("date -d '+2 min' '+%M %H'").split(' ') L(`echo '${Number(mm)} ${Number(hh)} * * * date > ~/cron-test.txt' | crontab -`) const cl = run('crontab -l', { id: 'cron-line' }) ctx.check('crontab -l shows the test job', cl.out === `${Number(mm)} ${Number(hh)} * * * date > ~/cron-test.txt`, cl.out) waitFor(L, '~/cron-test.txt', 200) const cr = run('cat ~/cron-test.txt', { id: 'cron-ran' }) ctx.check('cron ran the job at that New York time, without a restart', NY.test(cr.out) && cr.out.includes(` ${hh}:${mm}:`), `${hh}:${mm} → ${cr.out}`) const tm = run('systemctl list-timers apt-daily-upgrade.timer --no-pager', { id: 'timer' }) ctx.check('systemd timers follow too: the automatic-update timer (OnCalendar 6:00) is now due at 06:xx New York time', /\b06:\d\d:\d\d E[SD]T\b/.test(tm.out), tm.out) const jl = run('sudo journalctl -q -t systemd-timedated --no-pager', { id: 'journal' }) ctx.check(`journalctl shows the change: "Changed time zone to '${ZONE}'"`, jl.out.includes(`Changed time zone to '${ZONE}' (`), jl.out) ctx.check('(the log line names the zone\'s SUMMER abbreviation, EDT, even in winter: timedated.c prints tzname[daylight])', jl.out.includes(`'${ZONE}' (EDT).`), jl.out) // ── step 5: what keeps the old zone ────────────────────────────────────────────────────── const clock = L('sleep 5; tail -n 2 /tmp/clock.txt') ctx.check('(hidden) a program started before the change still prints UTC times', /UTC$/.test(clock) && !NY.test(clock), clock) L('pkill -f /tmp/clock.txt; rm -f /tmp/clock.txt') run("logger 'zone test 1'", { id: 'logger-1' }) const s1 = run("sudo grep 'zone test' /var/log/syslog", { id: 'syslog-1' }) ctx.check('/var/log/syslog still stamps new lines with +00:00 (rsyslog started on UTC)', /\+00:00 web-server deploy: zone test 1$/m.test(s1.out), s1.out) const rs = run('sudo systemctl restart rsyslog', { id: 'rsyslog-restart' }) ctx.check('restarting rsyslog prints nothing', rs.exit === 0 && rs.out === '', rs.out) run("logger 'zone test 2'", { id: 'logger-2' }) const s2 = run("sudo grep 'zone test' /var/log/syslog", { id: 'syslog-2' }) ctx.check('after the restart new lines carry the New York offset (-05:00 or -04:00)', /-0[45]:00 web-server deploy: zone test 2$/m.test(s2.out), s2.out) const tz0 = run('cat /etc/timezone', { id: 'etc-timezone' }) // 24.04 still ships /etc/timezone (and timedatectl leaves it stale); 26.04 has none at all (seen 2026-11-15) if (RELEASE === '24.04') ctx.check('timedatectl does NOT update /etc/timezone: it still says Etc/UTC', tz0.out === 'Etc/UTC', tz0.out) else ctx.check(`there is no /etc/timezone on Ubuntu ${RELEASE}`, /No such file or directory/.test(tz0.out), tz0.out) const rc = run('sudo dpkg-reconfigure -f noninteractive tzdata', { id: 'reconfigure' }) ctx.check(`dpkg-reconfigure tzdata reads the zone from /etc/localtime: "Current default time zone: '${ZONE}'"`, rc.out.includes(`Current default time zone: '${ZONE}'`), rc.out) const tz1 = run('cat /etc/timezone', { id: 'etc-timezone-2' }) if (RELEASE === '24.04') ctx.check(`/etc/timezone now says ${ZONE}`, tz1.out === ZONE, tz1.out) else ctx.check('dpkg-reconfigure tzdata does not create /etc/timezone either', /No such file or directory/.test(tz1.out), tz1.out) // ── step 6: reboot ─────────────────────────────────────────────────────────────────────── const secs = rebootBox() ctx.capture('sudo reboot', '', { id: 'reboot' }) ctx.check('the server comes back after the reboot', typeof secs === 'number', String(secs)) waitSync(L) const st2 = run('timedatectl', { id: 'status-reboot' }) ctx.check(`after the reboot the zone is still ${ZONE} and the clock synchronized`, st2.out.includes(`Time zone: ${ZONE}`) && /System clock synchronized: yes/.test(st2.out), st2.out) L("logger 'zone test 3'") ctx.check('(after the reboot syslog lines carry the New York offset with no restart)', /-0[45]:00 web-server deploy: zone test 3$/m.test(L("sudo grep 'zone test 3' /var/log/syslog")), L("sudo grep 'zone test 3' /var/log/syslog")) // ── another zone for one command or one job ────────────────────────────────────────────── const tok = run('TZ=Asia/Tokyo date', { id: 'tz-env' }) ctx.check('TZ=Asia/Tokyo date shows Tokyo time for that one command', /\bJST\b/.test(tok.out), tok.out) ctx.check('…and the server zone is unchanged', NY.test(L('date')), L('date')) const cal = run("systemd-analyze calendar '*-*-* 09:00 Asia/Tokyo'", { id: 'calendar' }) ctx.check('a systemd timer can name its own zone: systemd-analyze shows when 09:00 Tokyo falls in server time', /Normalized form: \*-\*-\* 09:00:00 Asia\/Tokyo/.test(cal.out) && /Next elapse: .* E[SD]T/.test(cal.out), cal.out) // CRON_TZ: Ubuntu's cron ignores it (hidden; a control job beside it proves cron is running) const [um, uh] = L("TZ=UTC date -d '+2 min' '+%M %H'").split(' ') const [cm, ch] = L("date -d '+2 min' '+%M %H'").split(' ') L(`printf 'CRON_TZ=UTC\\n${Number(um)} ${Number(uh)} * * * date > ~/crontz.txt\\n${Number(cm)} ${Number(ch)} * * * date > ~/control.txt\\n' | crontab -`) const control = waitFor(L, '~/control.txt', 200) L('sleep 5') ctx.check('(hidden) CRON_TZ=UTC is ignored: a job at UTC+2 min never ran, while the control job beside it did', NY.test(control) && L('ls ~/crontz.txt 2>&1').includes('No such file'), `${uh}:${um} UTC / control ${control}`) L('crontab -r; rm -f ~/cron-test.txt ~/control.txt ~/crontz.txt') const sync = L('timedatectl show -p NTPSynchronized --value') ctx.check('(the clock is synchronized)', sync === 'yes', sync, { reader: { cmd: 'timedatectl show -p NTPSynchronized --value', expect: '^yes$' }, }) ctx.stepsDone() // the article's steps end here; the undo follows reportBox( ctx, L, `A fresh Ubuntu ${RELEASE} server from Ubuntu’s cloud image, on UTC as a provider hands it over, reached over SSH as a sudo user.`, ['systemd', 'tzdata', 'cron', 'rsyslog'], ) // ── undo ───────────────────────────────────────────────────────────────────────────────── run('sudo timedatectl set-timezone Etc/UTC', { id: 'undo-set' }) run('sudo dpkg-reconfigure -f noninteractive tzdata', { id: 'undo-reconfigure' }) run('sudo systemctl restart rsyslog', { id: 'undo-rsyslog' }) const back = run('timedatectl', { id: 'undo-status' }) ctx.check('after the undo the server is back on "Etc/UTC (UTC, +0000)"', /Time zone: Etc\/UTC \(UTC, \+0000\)/.test(back.out), back.out) ctx.check('(/etc/localtime and /etc/timezone are back to Etc/UTC)', /zoneinfo\/Etc\/UTC$/.test(L('ls -l /etc/localtime')) && (RELEASE !== '24.04' || L('cat /etc/timezone') === 'Etc/UTC'), L('ls -l /etc/localtime; cat /etc/timezone')) }) export default check