| 1 |
<?xml version='1.0'?> <!--*-nxml-*--> |
| 2 |
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
| 3 |
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> |
| 4 |
<!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
| 5 |
|
| 6 |
<refentry id="timedatectl" conditional='ENABLE_TIMEDATECTL' |
| 7 |
xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 8 |
|
| 9 |
<refentryinfo> |
| 10 |
<title>timedatectl</title> |
| 11 |
<productname>systemd</productname> |
| 12 |
</refentryinfo> |
| 13 |
|
| 14 |
<refmeta> |
| 15 |
<refentrytitle>timedatectl</refentrytitle> |
| 16 |
<manvolnum>1</manvolnum> |
| 17 |
</refmeta> |
| 18 |
|
| 19 |
<refnamediv> |
| 20 |
<refname>timedatectl</refname> |
| 21 |
<refpurpose>Control the system time and date</refpurpose> |
| 22 |
</refnamediv> |
| 23 |
|
| 24 |
<refsynopsisdiv> |
| 25 |
<cmdsynopsis> |
| 26 |
<command>timedatectl</command> |
| 27 |
<arg choice="opt" rep="repeat">OPTIONS</arg> |
| 28 |
<arg choice="req">COMMAND</arg> |
| 29 |
</cmdsynopsis> |
| 30 |
</refsynopsisdiv> |
| 31 |
|
| 32 |
<refsect1> |
| 33 |
<title>Description</title> |
| 34 |
|
| 35 |
<para><command>timedatectl</command> may be used to query and change the system clock and its settings, |
| 36 |
and enable or disable time synchronization services.</para> |
| 37 |
|
| 38 |
<para>Use |
| 39 |
<citerefentry><refentrytitle>systemd-firstboot</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
| 40 |
to initialize the system time zone for mounted (but not booted) |
| 41 |
system images.</para> |
| 42 |
|
| 43 |
<para><command>timedatectl</command> may be used to show the current status of time synchronization |
| 44 |
services, for example |
| 45 |
<citerefentry><refentrytitle>systemd-timesyncd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>. |
| 46 |
</para> |
| 47 |
|
| 48 |
</refsect1> |
| 49 |
|
| 50 |
<refsect1> |
| 51 |
<title>Commands</title> |
| 52 |
|
| 53 |
<para>The following commands are understood:</para> |
| 54 |
|
| 55 |
<variablelist> |
| 56 |
<varlistentry> |
| 57 |
<term><command>status</command></term> |
| 58 |
|
| 59 |
<listitem><para>Show current settings of the system clock and RTC, including whether network time |
| 60 |
synchronization is active. If no command is specified, this is the implied default. |
| 61 |
</para> |
| 62 |
|
| 63 |
<xi:include href="version-info.xml" xpointer="v195"/></listitem> |
| 64 |
</varlistentry> |
| 65 |
|
| 66 |
<varlistentry> |
| 67 |
<term><command>show</command></term> |
| 68 |
|
| 69 |
<listitem><para>Show the same information as <option>status</option>, but in machine readable form. |
| 70 |
This command is intended to be used whenever computer-parsable output is required. |
| 71 |
Use <option>status</option> if you are looking for formatted human-readable output.</para> |
| 72 |
<para>By default, empty properties are suppressed. Use <option>--all</option> to show those too. |
| 73 |
To select specific properties to show, use <option>--property=</option>.</para> |
| 74 |
|
| 75 |
<xi:include href="version-info.xml" xpointer="v239"/></listitem> |
| 76 |
</varlistentry> |
| 77 |
|
| 78 |
<varlistentry> |
| 79 |
<term><command>set-time [TIME]</command></term> |
| 80 |
|
| 81 |
<listitem><para>Set the system clock to the specified timestamp. This will also update the RTC time |
| 82 |
accordingly. The timestamp may be specified in the format <literal>2012-10-30 18:17:16</literal>. See |
| 83 |
<citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry> |
| 84 |
for more details about acceptable timestamp format.</para> |
| 85 |
|
| 86 |
<xi:include href="version-info.xml" xpointer="v195"/></listitem> |
| 87 |
</varlistentry> |
| 88 |
|
| 89 |
<varlistentry> |
| 90 |
<term><command>set-timezone [TIMEZONE]</command></term> |
| 91 |
|
| 92 |
<listitem><para>Set the system time zone to the specified |
| 93 |
value. Available timezones can be listed with |
| 94 |
<command>list-timezones</command>. If the RTC is configured to |
| 95 |
be in the local time, this will also update the RTC time. This |
| 96 |
call will alter the <filename>/etc/localtime</filename> |
| 97 |
symlink. See |
| 98 |
<citerefentry><refentrytitle>localtime</refentrytitle><manvolnum>5</manvolnum></citerefentry> |
| 99 |
for more information.</para> |
| 100 |
|
| 101 |
<xi:include href="version-info.xml" xpointer="v195"/></listitem> |
| 102 |
</varlistentry> |
| 103 |
|
| 104 |
<varlistentry> |
| 105 |
<term><command>list-timezones</command></term> |
| 106 |
|
| 107 |
<listitem><para>List available time zones, one per line. |
| 108 |
Entries from the list can be set as the system timezone with |
| 109 |
<command>set-timezone</command>.</para> |
| 110 |
|
| 111 |
<xi:include href="version-info.xml" xpointer="v195"/></listitem> |
| 112 |
</varlistentry> |
| 113 |
|
| 114 |
<varlistentry> |
| 115 |
<term><command>set-local-rtc [BOOL]</command></term> |
| 116 |
|
| 117 |
<listitem><para>Takes a boolean argument. If |
| 118 |
<literal>0</literal>, the system is configured to maintain the |
| 119 |
RTC in universal time. If <literal>1</literal>, it will |
| 120 |
maintain the RTC in local time instead. Note that maintaining |
| 121 |
the RTC in the local timezone is not fully supported and will |
| 122 |
create various problems with time zone changes and daylight |
| 123 |
saving adjustments. If at all possible, keep the RTC in UTC |
| 124 |
mode. Note that invoking this will also synchronize the RTC |
| 125 |
from the system clock, unless |
| 126 |
<option>--adjust-system-clock</option> is passed (see above). |
| 127 |
This command will change the 3rd line of |
| 128 |
<filename>/etc/adjtime</filename>, as documented in |
| 129 |
<citerefentry project='man-pages'><refentrytitle>hwclock</refentrytitle><manvolnum>8</manvolnum></citerefentry>. |
| 130 |
</para> |
| 131 |
|
| 132 |
<xi:include href="version-info.xml" xpointer="v195"/></listitem> |
| 133 |
</varlistentry> |
| 134 |
|
| 135 |
<varlistentry> |
| 136 |
<term><command>set-ntp [BOOL]</command></term> |
| 137 |
|
| 138 |
<listitem><para>Takes a boolean argument. Controls whether network time synchronization is active and |
| 139 |
enabled (if available). If the argument is true, this enables and starts the first existing network |
| 140 |
synchronization service. If the argument is false, then this disables and stops the known network |
| 141 |
synchronization services. The way that the list of services is built is described in |
| 142 |
<citerefentry><refentrytitle>systemd-timedated.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>. |
| 143 |
</para> |
| 144 |
|
| 145 |
<xi:include href="version-info.xml" xpointer="v195"/></listitem> |
| 146 |
</varlistentry> |
| 147 |
|
| 148 |
</variablelist> |
| 149 |
|
| 150 |
<refsect2> |
| 151 |
<title>systemd-timesyncd Commands</title> |
| 152 |
|
| 153 |
<para>The following commands are specific to |
| 154 |
<citerefentry><refentrytitle>systemd-timesyncd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>. |
| 155 |
</para> |
| 156 |
|
| 157 |
<variablelist> |
| 158 |
<varlistentry> |
| 159 |
<term><command>timesync-status</command></term> |
| 160 |
|
| 161 |
<listitem><para>Show current status of |
| 162 |
<citerefentry><refentrytitle>systemd-timesyncd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>. |
| 163 |
If <option>--monitor</option> is specified, then this will monitor the status updates.</para> |
| 164 |
|
| 165 |
<xi:include href="version-info.xml" xpointer="v239"/></listitem> |
| 166 |
</varlistentry> |
| 167 |
|
| 168 |
<varlistentry> |
| 169 |
<term><command>show-timesync</command></term> |
| 170 |
|
| 171 |
<listitem><para>Show the same information as <option>timesync-status</option>, but in machine readable form. |
| 172 |
This command is intended to be used whenever computer-parsable output is required. |
| 173 |
Use <option>timesync-status</option> if you are looking for formatted human-readable output.</para> |
| 174 |
<para>By default, empty properties are suppressed. Use <option>--all</option> to show those too. |
| 175 |
To select specific properties to show, use <option>--property=</option>.</para> |
| 176 |
|
| 177 |
<xi:include href="version-info.xml" xpointer="v239"/></listitem> |
| 178 |
</varlistentry> |
| 179 |
|
| 180 |
<varlistentry> |
| 181 |
<term><command>ntp-servers <replaceable>INTERFACE</replaceable> <replaceable>SERVER</replaceable>…</command></term> |
| 182 |
|
| 183 |
<listitem><para>Set the interface specific NTP servers. This command can be used only when the |
| 184 |
interface is managed by <command>systemd-networkd</command>.</para> |
| 185 |
|
| 186 |
<xi:include href="version-info.xml" xpointer="v243"/></listitem> |
| 187 |
</varlistentry> |
| 188 |
|
| 189 |
<varlistentry> |
| 190 |
<term><command>revert <replaceable>INTERFACE</replaceable></command></term> |
| 191 |
|
| 192 |
<listitem><para>Revert the interface specific NTP servers. This command can be used only when |
| 193 |
the interface is managed by <command>systemd-networkd</command>.</para> |
| 194 |
|
| 195 |
<xi:include href="version-info.xml" xpointer="v243"/></listitem> |
| 196 |
</varlistentry> |
| 197 |
</variablelist> |
| 198 |
|
| 199 |
</refsect2> |
| 200 |
|
| 201 |
</refsect1> |
| 202 |
|
| 203 |
<refsect1> |
| 204 |
<title>Options</title> |
| 205 |
|
| 206 |
<para>The following options are understood:</para> |
| 207 |
|
| 208 |
<variablelist> |
| 209 |
<varlistentry> |
| 210 |
<term><option>--adjust-system-clock</option></term> |
| 211 |
|
| 212 |
<listitem><para>If <command>set-local-rtc</command> is invoked |
| 213 |
and this option is passed, the system clock is synchronized |
| 214 |
from the RTC again, taking the new setting into account. |
| 215 |
Otherwise, the RTC is synchronized from the system |
| 216 |
clock.</para> |
| 217 |
|
| 218 |
<xi:include href="version-info.xml" xpointer="v195"/></listitem> |
| 219 |
</varlistentry> |
| 220 |
|
| 221 |
<varlistentry> |
| 222 |
<term><option>--monitor</option></term> |
| 223 |
|
| 224 |
<listitem><para>If <command>timesync-status</command> is invoked and this option is passed, then |
| 225 |
<command>timedatectl</command> monitors the status of |
| 226 |
<citerefentry><refentrytitle>systemd-timesyncd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 227 |
and updates the outputs. Use <keycombo><keycap>Ctrl</keycap><keycap>C</keycap></keycombo> to terminate the |
| 228 |
monitoring.</para> |
| 229 |
|
| 230 |
<xi:include href="version-info.xml" xpointer="v239"/></listitem> |
| 231 |
</varlistentry> |
| 232 |
|
| 233 |
<varlistentry> |
| 234 |
<term><option>-a</option></term> |
| 235 |
<term><option>--all</option></term> |
| 236 |
|
| 237 |
<listitem><para>When showing properties of |
| 238 |
<citerefentry><refentrytitle>systemd-timesyncd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
| 239 |
show all properties regardless of whether they are set or not.</para> |
| 240 |
|
| 241 |
<xi:include href="version-info.xml" xpointer="v239"/></listitem> |
| 242 |
</varlistentry> |
| 243 |
|
| 244 |
<varlistentry> |
| 245 |
<term><option>-p</option></term> |
| 246 |
<term><option>--property=</option></term> |
| 247 |
|
| 248 |
<listitem><para>When showing properties of |
| 249 |
<citerefentry><refentrytitle>systemd-timesyncd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
| 250 |
limit display to certain properties as specified as argument. If not specified, all set properties are shown. |
| 251 |
The argument should be a property name, such as <literal>ServerName</literal>. If specified more than once, |
| 252 |
all properties with the specified names are shown.</para> |
| 253 |
|
| 254 |
<xi:include href="version-info.xml" xpointer="v239"/></listitem> |
| 255 |
</varlistentry> |
| 256 |
|
| 257 |
<varlistentry> |
| 258 |
<term><option>--value</option></term> |
| 259 |
|
| 260 |
<listitem> |
| 261 |
<para>When printing properties with <command>show-timesync</command>, only print the value, and skip the |
| 262 |
property name and <literal>=</literal>.</para> |
| 263 |
|
| 264 |
<xi:include href="version-info.xml" xpointer="v239"/></listitem> |
| 265 |
</varlistentry> |
| 266 |
|
| 267 |
<varlistentry id='option-P'> |
| 268 |
<term><option>-P</option></term> |
| 269 |
|
| 270 |
<listitem> |
| 271 |
<xi:include href="standard-options.xml" xpointer="xpointer(//varlistentry[@id='option-P']/listitem/para)" /> |
| 272 |
<xi:include href="version-info.xml" xpointer="v256"/> |
| 273 |
</listitem> |
| 274 |
</varlistentry> |
| 275 |
|
| 276 |
<xi:include href="user-system-options.xml" xpointer="host" /> |
| 277 |
<xi:include href="user-system-options.xml" xpointer="machine" /> |
| 278 |
|
| 279 |
<xi:include href="standard-options.xml" xpointer="no-ask-password" /> |
| 280 |
<xi:include href="standard-options.xml" xpointer="help" /> |
| 281 |
<xi:include href="standard-options.xml" xpointer="version" /> |
| 282 |
<xi:include href="standard-options.xml" xpointer="no-pager" /> |
| 283 |
</variablelist> |
| 284 |
</refsect1> |
| 285 |
|
| 286 |
<refsect1> |
| 287 |
<title>Exit status</title> |
| 288 |
|
| 289 |
<para>On success, 0 is returned, a non-zero failure code otherwise.</para> |
| 290 |
</refsect1> |
| 291 |
|
| 292 |
<xi:include href="common-variables.xml" /> |
| 293 |
|
| 294 |
<refsect1> |
| 295 |
<title>Examples</title> |
| 296 |
<para>Show current settings: |
| 297 |
<programlisting>$ timedatectl |
| 298 |
Local time: Thu 2017-09-21 16:08:56 CEST |
| 299 |
Universal time: Thu 2017-09-21 14:08:56 UTC |
| 300 |
RTC time: Thu 2017-09-21 14:08:56 |
| 301 |
Time zone: Europe/Warsaw (CEST, +0200) |
| 302 |
System clock synchronized: yes |
| 303 |
NTP service: active |
| 304 |
RTC in local TZ: no</programlisting> |
| 305 |
</para> |
| 306 |
|
| 307 |
<para>Enable network time synchronization: |
| 308 |
<programlisting>$ timedatectl set-ntp true |
| 309 |
==== AUTHENTICATING FOR org.freedesktop.timedate1.set-ntp === |
| 310 |
Authentication is required to control whether network time synchronization shall be enabled. |
| 311 |
Authenticating as: user |
| 312 |
Password: ******** |
| 313 |
==== AUTHENTICATION COMPLETE ===</programlisting> |
| 314 |
|
| 315 |
<programlisting>$ systemctl status systemd-timesyncd.service |
| 316 |
● systemd-timesyncd.service - Network Time Synchronization |
| 317 |
Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled) |
| 318 |
Active: active (running) since Mo 2015-03-30 14:20:38 CEST; 5s ago |
| 319 |
Docs: man:systemd-timesyncd.service(8) |
| 320 |
Main PID: 595 (systemd-timesyn) |
| 321 |
Status: "Using Time Server 216.239.38.15:123 (time4.google.com)." |
| 322 |
CGroup: /system.slice/systemd-timesyncd.service |
| 323 |
└─595 /usr/lib/systemd/systemd-timesyncd |
| 324 |
…</programlisting> |
| 325 |
</para> |
| 326 |
|
| 327 |
<para>Show current status of |
| 328 |
<citerefentry><refentrytitle>systemd-timesyncd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>: |
| 329 |
<programlisting>$ timedatectl timesync-status |
| 330 |
Server: 216.239.38.15 (time4.google.com) |
| 331 |
Poll interval: 1min 4s (min: 32s; max 34min 8s) |
| 332 |
Leap: normal |
| 333 |
Version: 4 |
| 334 |
Stratum: 1 |
| 335 |
Reference: GPS |
| 336 |
Precision: 1us (-20) |
| 337 |
Root distance: 335us (max: 5s) |
| 338 |
Offset: +316us |
| 339 |
Delay: 349us |
| 340 |
Jitter: 0 |
| 341 |
Packet count: 1 |
| 342 |
Frequency: -8.802ppm</programlisting> |
| 343 |
</para> |
| 344 |
|
| 345 |
</refsect1> |
| 346 |
|
| 347 |
<refsect1> |
| 348 |
<title>See Also</title> |
| 349 |
<para><simplelist type="inline"> |
| 350 |
<member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 351 |
<member><citerefentry project='man-pages'><refentrytitle>hwclock</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 352 |
<member><citerefentry project='man-pages'><refentrytitle>date</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 353 |
<member><citerefentry><refentrytitle>localtime</refentrytitle><manvolnum>5</manvolnum></citerefentry></member> |
| 354 |
<member><citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 355 |
<member><citerefentry><refentrytitle>systemd-timedated.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 356 |
<member><citerefentry><refentrytitle>systemd-timesyncd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 357 |
<member><citerefentry><refentrytitle>systemd-firstboot</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 358 |
</simplelist></para> |
| 359 |
</refsect1> |
| 360 |
|
| 361 |
</refentry> |