]>
Commit | Line | Data |
---|---|---|
6d0274f1 | 1 | <?xml version='1.0'?> <!--*-nxml-*--> |
3a54a157 | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
eea10b26 | 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> |
db9ecf05 | 4 | <!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
6d0274f1 | 5 | |
1e4acc77 | 6 | <refentry id="timedatectl" conditional='ENABLE_TIMEDATECTL' |
798d3a52 ZJS |
7 | xmlns:xi="http://www.w3.org/2001/XInclude"> |
8 | ||
9 | <refentryinfo> | |
10 | <title>timedatectl</title> | |
11 | <productname>systemd</productname> | |
798d3a52 ZJS |
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> | |
afaae43b ZJS |
26 | <command>timedatectl</command> |
27 | <arg choice="opt" rep="repeat">OPTIONS</arg> | |
28 | <arg choice="req">COMMAND</arg> | |
798d3a52 ZJS |
29 | </cmdsynopsis> |
30 | </refsynopsisdiv> | |
31 | ||
32 | <refsect1> | |
33 | <title>Description</title> | |
34 | ||
afaae43b ZJS |
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> | |
798d3a52 ZJS |
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> | |
1e4acc77 | 42 | |
afaae43b ZJS |
43 | <para><command>timedatectl</command> may be used to show the current status of time synchronization |
44 | services, for example | |
1e4acc77 YW |
45 | <citerefentry><refentrytitle>systemd-timesyncd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>. |
46 | </para> | |
47 | ||
798d3a52 ZJS |
48 | </refsect1> |
49 | ||
24fcd009 YW |
50 | <refsect1> |
51 | <title>Commands</title> | |
798d3a52 ZJS |
52 | |
53 | <para>The following commands are understood:</para> | |
54 | ||
55 | <variablelist> | |
56 | <varlistentry> | |
57 | <term><command>status</command></term> | |
58 | ||
afaae43b ZJS |
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. | |
aefdc112 AK |
61 | </para> |
62 | ||
63 | <xi:include href="version-info.xml" xpointer="v195"/></listitem> | |
798d3a52 ZJS |
64 | </varlistentry> |
65 | ||
ead0adb1 YW |
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. | |
ec07c3c8 AK |
73 | To select specific properties to show, use <option>--property=</option>.</para> |
74 | ||
75 | <xi:include href="version-info.xml" xpointer="v239"/></listitem> | |
ead0adb1 YW |
76 | </varlistentry> |
77 | ||
798d3a52 ZJS |
78 | <varlistentry> |
79 | <term><command>set-time [TIME]</command></term> | |
80 | ||
81 | <listitem><para>Set the system clock to the specified time. | |
82 | This will also update the RTC time accordingly. The time may | |
83 | be specified in the format "2012-10-30 | |
aefdc112 AK |
84 | 18:17:16".</para> |
85 | ||
86 | <xi:include href="version-info.xml" xpointer="v195"/></listitem> | |
798d3a52 ZJS |
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> | |
aefdc112 AK |
99 | for more information.</para> |
100 | ||
101 | <xi:include href="version-info.xml" xpointer="v195"/></listitem> | |
798d3a52 ZJS |
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 | |
aefdc112 AK |
109 | <command>set-timezone</command>.</para> |
110 | ||
111 | <xi:include href="version-info.xml" xpointer="v195"/></listitem> | |
798d3a52 ZJS |
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>. | |
aefdc112 AK |
130 | </para> |
131 | ||
132 | <xi:include href="version-info.xml" xpointer="v195"/></listitem> | |
798d3a52 ZJS |
133 | </varlistentry> |
134 | ||
135 | <varlistentry> | |
136 | <term><command>set-ntp [BOOL]</command></term> | |
137 | ||
afaae43b ZJS |
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 | |
9376b2aa AH |
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>. | |
aefdc112 AK |
143 | </para> |
144 | ||
145 | <xi:include href="version-info.xml" xpointer="v195"/></listitem> | |
798d3a52 ZJS |
146 | </varlistentry> |
147 | ||
148 | </variablelist> | |
149 | ||
ead0adb1 YW |
150 | <refsect2> |
151 | <title>systemd-timesyncd Commands</title> | |
1e4acc77 | 152 | |
ead0adb1 YW |
153 | <para>The following commands are specific to |
154 | <citerefentry><refentrytitle>systemd-timesyncd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>. | |
155 | </para> | |
1e4acc77 YW |
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>. | |
ec07c3c8 AK |
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> | |
1e4acc77 YW |
166 | </varlistentry> |
167 | ||
168 | <varlistentry> | |
169 | <term><command>show-timesync</command></term> | |
170 | ||
ead0adb1 YW |
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. | |
ec07c3c8 AK |
175 | To select specific properties to show, use <option>--property=</option>.</para> |
176 | ||
177 | <xi:include href="version-info.xml" xpointer="v239"/></listitem> | |
1e4acc77 | 178 | </varlistentry> |
159a855b YW |
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 | |
ec07c3c8 AK |
184 | interface is managed by <command>systemd-networkd</command>.</para> |
185 | ||
186 | <xi:include href="version-info.xml" xpointer="v243"/></listitem> | |
159a855b YW |
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 | |
ec07c3c8 AK |
193 | the interface is managed by <command>systemd-networkd</command>.</para> |
194 | ||
195 | <xi:include href="version-info.xml" xpointer="v243"/></listitem> | |
159a855b | 196 | </varlistentry> |
1e4acc77 YW |
197 | </variablelist> |
198 | ||
199 | </refsect2> | |
200 | ||
798d3a52 ZJS |
201 | </refsect1> |
202 | ||
203 | <refsect1> | |
e1fac8a6 ZJS |
204 | <title>Options</title> |
205 | ||
206 | <para>The following options are understood:</para> | |
207 | ||
208 | <variablelist> | |
209 | <varlistentry> | |
210 | <term><option>--no-ask-password</option></term> | |
211 | ||
212 | <listitem><para>Do not query the user for authentication for | |
ec07c3c8 AK |
213 | privileged operations.</para> |
214 | ||
215 | <xi:include href="version-info.xml" xpointer="v195"/></listitem> | |
e1fac8a6 ZJS |
216 | </varlistentry> |
217 | ||
218 | <varlistentry> | |
219 | <term><option>--adjust-system-clock</option></term> | |
220 | ||
221 | <listitem><para>If <command>set-local-rtc</command> is invoked | |
222 | and this option is passed, the system clock is synchronized | |
223 | from the RTC again, taking the new setting into account. | |
224 | Otherwise, the RTC is synchronized from the system | |
ec07c3c8 AK |
225 | clock.</para> |
226 | ||
227 | <xi:include href="version-info.xml" xpointer="v195"/></listitem> | |
e1fac8a6 ZJS |
228 | </varlistentry> |
229 | ||
230 | <varlistentry> | |
231 | <term><option>--monitor</option></term> | |
232 | ||
233 | <listitem><para>If <command>timesync-status</command> is invoked and this option is passed, then | |
234 | <command>timedatectl</command> monitors the status of | |
235 | <citerefentry><refentrytitle>systemd-timesyncd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
236 | and updates the outputs. Use <keycombo><keycap>Ctrl</keycap><keycap>C</keycap></keycombo> to terminate the | |
ec07c3c8 AK |
237 | monitoring.</para> |
238 | ||
239 | <xi:include href="version-info.xml" xpointer="v239"/></listitem> | |
e1fac8a6 ZJS |
240 | </varlistentry> |
241 | ||
242 | <varlistentry> | |
243 | <term><option>-a</option></term> | |
244 | <term><option>--all</option></term> | |
245 | ||
246 | <listitem><para>When showing properties of | |
247 | <citerefentry><refentrytitle>systemd-timesyncd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, | |
aefdc112 AK |
248 | show all properties regardless of whether they are set or not.</para> |
249 | ||
250 | <xi:include href="version-info.xml" xpointer="v239"/></listitem> | |
e1fac8a6 ZJS |
251 | </varlistentry> |
252 | ||
253 | <varlistentry> | |
254 | <term><option>-p</option></term> | |
255 | <term><option>--property=</option></term> | |
256 | ||
257 | <listitem><para>When showing properties of | |
258 | <citerefentry><refentrytitle>systemd-timesyncd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, | |
259 | limit display to certain properties as specified as argument. If not specified, all set properties are shown. | |
260 | The argument should be a property name, such as <literal>ServerName</literal>. If specified more than once, | |
ec07c3c8 AK |
261 | all properties with the specified names are shown.</para> |
262 | ||
263 | <xi:include href="version-info.xml" xpointer="v239"/></listitem> | |
e1fac8a6 ZJS |
264 | </varlistentry> |
265 | ||
266 | <varlistentry> | |
267 | <term><option>--value</option></term> | |
268 | ||
269 | <listitem> | |
270 | <para>When printing properties with <command>show-timesync</command>, only print the value, and skip the | |
ec07c3c8 AK |
271 | property name and <literal>=</literal>.</para> |
272 | ||
273 | <xi:include href="version-info.xml" xpointer="v239"/></listitem> | |
e1fac8a6 ZJS |
274 | </varlistentry> |
275 | ||
c5c61950 | 276 | <varlistentry id='option-P'> |
31e70e88 ZJS |
277 | <term><option>-P</option></term> |
278 | ||
279 | <listitem> | |
280 | <xi:include href="standard-options.xml" xpointer="xpointer(//varlistentry[@id='option-P']/listitem/para)" /> | |
281 | <xi:include href="version-info.xml" xpointer="v256"/> | |
282 | </listitem> | |
283 | </varlistentry> | |
284 | ||
e1fac8a6 ZJS |
285 | <xi:include href="user-system-options.xml" xpointer="host" /> |
286 | <xi:include href="user-system-options.xml" xpointer="machine" /> | |
287 | ||
288 | <xi:include href="standard-options.xml" xpointer="help" /> | |
289 | <xi:include href="standard-options.xml" xpointer="version" /> | |
290 | <xi:include href="standard-options.xml" xpointer="no-pager" /> | |
291 | </variablelist> | |
292 | </refsect1> | |
293 | ||
294 | <refsect1> | |
798d3a52 ZJS |
295 | <title>Exit status</title> |
296 | ||
afaae43b | 297 | <para>On success, 0 is returned, a non-zero failure code otherwise.</para> |
798d3a52 ZJS |
298 | </refsect1> |
299 | ||
4ef3ca34 | 300 | <xi:include href="common-variables.xml" /> |
798d3a52 ZJS |
301 | |
302 | <refsect1> | |
303 | <title>Examples</title> | |
304 | <para>Show current settings: | |
305 | <programlisting>$ timedatectl | |
326208e0 YW |
306 | Local time: Thu 2017-09-21 16:08:56 CEST |
307 | Universal time: Thu 2017-09-21 14:08:56 UTC | |
308 | RTC time: Thu 2017-09-21 14:08:56 | |
309 | Time zone: Europe/Warsaw (CEST, +0200) | |
310 | System clock synchronized: yes | |
311 | NTP service: active | |
312 | RTC in local TZ: no</programlisting> | |
798d3a52 | 313 | </para> |
be1015dd | 314 | |
b90930c7 | 315 | <para>Enable network time synchronization: |
798d3a52 | 316 | <programlisting>$ timedatectl set-ntp true |
be1015dd ZJS |
317 | ==== AUTHENTICATING FOR org.freedesktop.timedate1.set-ntp === |
318 | Authentication is required to control whether network time synchronization shall be enabled. | |
319 | Authenticating as: user | |
320 | Password: ******** | |
9fccdb0f | 321 | ==== AUTHENTICATION COMPLETE ===</programlisting> |
be1015dd | 322 | |
57506e7d LP |
323 | <programlisting>$ systemctl status systemd-timesyncd.service |
324 | ● systemd-timesyncd.service - Network Time Synchronization | |
12b42c76 | 325 | Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled) |
57506e7d LP |
326 | Active: active (running) since Mo 2015-03-30 14:20:38 CEST; 5s ago |
327 | Docs: man:systemd-timesyncd.service(8) | |
328 | Main PID: 595 (systemd-timesyn) | |
329 | Status: "Using Time Server 216.239.38.15:123 (time4.google.com)." | |
330 | CGroup: /system.slice/systemd-timesyncd.service | |
12b42c76 | 331 | └─595 /usr/lib/systemd/systemd-timesyncd |
1eecafb8 | 332 | …</programlisting> |
798d3a52 | 333 | </para> |
1e4acc77 YW |
334 | |
335 | <para>Show current status of | |
336 | <citerefentry><refentrytitle>systemd-timesyncd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>: | |
337 | <programlisting>$ timedatectl timesync-status | |
338 | Server: 216.239.38.15 (time4.google.com) | |
339 | Poll interval: 1min 4s (min: 32s; max 34min 8s) | |
340 | Leap: normal | |
341 | Version: 4 | |
342 | Stratum: 1 | |
343 | Reference: GPS | |
344 | Precision: 1us (-20) | |
345 | Root distance: 335us (max: 5s) | |
346 | Offset: +316us | |
347 | Delay: 349us | |
348 | Jitter: 0 | |
349 | Packet count: 1 | |
350 | Frequency: -8.802ppm</programlisting> | |
351 | </para> | |
352 | ||
798d3a52 ZJS |
353 | </refsect1> |
354 | ||
355 | <refsect1> | |
356 | <title>See Also</title> | |
13a69c12 DT |
357 | <para><simplelist type="inline"> |
358 | <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> | |
359 | <member><citerefentry project='man-pages'><refentrytitle>hwclock</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> | |
360 | <member><citerefentry project='man-pages'><refentrytitle>date</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> | |
361 | <member><citerefentry><refentrytitle>localtime</refentrytitle><manvolnum>5</manvolnum></citerefentry></member> | |
362 | <member><citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> | |
363 | <member><citerefentry><refentrytitle>systemd-timedated.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> | |
364 | <member><citerefentry><refentrytitle>systemd-timesyncd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> | |
365 | <member><citerefentry><refentrytitle>systemd-firstboot</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> | |
366 | </simplelist></para> | |
798d3a52 | 367 | </refsect1> |
6d0274f1 LP |
368 | |
369 | </refentry> |