]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/timedatectl.xml
test-execute: Add tests for new PassEnvironment= directive
[thirdparty/systemd.git] / man / timedatectl.xml
CommitLineData
6d0274f1
LP
1<?xml version='1.0'?> <!--*-nxml-*-->
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
12b42c76 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6d0274f1
LP
4
5<!--
6 This file is part of systemd.
7
8 Copyright 2012 Lennart Poettering
9
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22-->
23
21ac6ff1 24<refentry id="timedatectl" conditional='ENABLE_TIMEDATED'
798d3a52
ZJS
25 xmlns:xi="http://www.w3.org/2001/XInclude">
26
27 <refentryinfo>
28 <title>timedatectl</title>
29 <productname>systemd</productname>
30
31 <authorgroup>
32 <author>
33 <contrib>Developer</contrib>
34 <firstname>Lennart</firstname>
35 <surname>Poettering</surname>
36 <email>lennart@poettering.net</email>
37 </author>
38 </authorgroup>
39 </refentryinfo>
40
41 <refmeta>
42 <refentrytitle>timedatectl</refentrytitle>
43 <manvolnum>1</manvolnum>
44 </refmeta>
45
46 <refnamediv>
47 <refname>timedatectl</refname>
48 <refpurpose>Control the system time and date</refpurpose>
49 </refnamediv>
50
51 <refsynopsisdiv>
52 <cmdsynopsis>
53 <command>timedatectl <arg choice="opt" rep="repeat">OPTIONS</arg> <arg choice="req">COMMAND</arg></command>
54 </cmdsynopsis>
55 </refsynopsisdiv>
56
57 <refsect1>
58 <title>Description</title>
59
60 <para><command>timedatectl</command> may be used to query and
61 change the system clock and its settings.</para>
62
63 <para>Use
64 <citerefentry><refentrytitle>systemd-firstboot</refentrytitle><manvolnum>1</manvolnum></citerefentry>
65 to initialize the system time zone for mounted (but not booted)
66 system images.</para>
67 </refsect1>
68
69 <refsect1>
70 <title>Options</title>
71
72 <para>The following options are understood:</para>
73
74 <variablelist>
75 <varlistentry>
76 <term><option>--no-ask-password</option></term>
77
78 <listitem><para>Do not query the user for authentication for
79 privileged operations.</para></listitem>
80 </varlistentry>
81
82 <varlistentry>
83 <term><option>--adjust-system-clock</option></term>
84
85 <listitem><para>If <command>set-local-rtc</command> is invoked
86 and this option is passed, the system clock is synchronized
87 from the RTC again, taking the new setting into account.
88 Otherwise, the RTC is synchronized from the system
89 clock.</para></listitem>
90 </varlistentry>
91
92 <xi:include href="user-system-options.xml" xpointer="host" />
93 <xi:include href="user-system-options.xml" xpointer="machine" />
94
95 <xi:include href="standard-options.xml" xpointer="help" />
96 <xi:include href="standard-options.xml" xpointer="version" />
97 <xi:include href="standard-options.xml" xpointer="no-pager" />
98 </variablelist>
99
100 <para>The following commands are understood:</para>
101
102 <variablelist>
103 <varlistentry>
104 <term><command>status</command></term>
105
ff5921ba 106 <listitem><para>Show current settings of the system clock and
2fc4f5bd 107 RTC, including whether network time synchronization is
b90930c7 108 on. Note that whether network time synchronization is on
ff5921ba 109 simply reflects whether the
57506e7d 110 <filename>systemd-timesyncd.service</filename> unit is
b938cb90 111 enabled. Even if this command shows the status as off, a
b90930c7 112 different service might still synchronize the clock with the
2fc4f5bd 113 network.</para></listitem>
798d3a52
ZJS
114 </varlistentry>
115
116 <varlistentry>
117 <term><command>set-time [TIME]</command></term>
118
119 <listitem><para>Set the system clock to the specified time.
120 This will also update the RTC time accordingly. The time may
121 be specified in the format "2012-10-30
122 18:17:16".</para></listitem>
123 </varlistentry>
124
125 <varlistentry>
126 <term><command>set-timezone [TIMEZONE]</command></term>
127
128 <listitem><para>Set the system time zone to the specified
129 value. Available timezones can be listed with
130 <command>list-timezones</command>. If the RTC is configured to
131 be in the local time, this will also update the RTC time. This
132 call will alter the <filename>/etc/localtime</filename>
133 symlink. See
134 <citerefentry><refentrytitle>localtime</refentrytitle><manvolnum>5</manvolnum></citerefentry>
135 for more information.</para></listitem>
136 </varlistentry>
137
138 <varlistentry>
139 <term><command>list-timezones</command></term>
140
141 <listitem><para>List available time zones, one per line.
142 Entries from the list can be set as the system timezone with
143 <command>set-timezone</command>.</para></listitem>
144 </varlistentry>
145
146 <varlistentry>
147 <term><command>set-local-rtc [BOOL]</command></term>
148
149 <listitem><para>Takes a boolean argument. If
150 <literal>0</literal>, the system is configured to maintain the
151 RTC in universal time. If <literal>1</literal>, it will
152 maintain the RTC in local time instead. Note that maintaining
153 the RTC in the local timezone is not fully supported and will
154 create various problems with time zone changes and daylight
155 saving adjustments. If at all possible, keep the RTC in UTC
156 mode. Note that invoking this will also synchronize the RTC
157 from the system clock, unless
158 <option>--adjust-system-clock</option> is passed (see above).
159 This command will change the 3rd line of
160 <filename>/etc/adjtime</filename>, as documented in
161 <citerefentry project='man-pages'><refentrytitle>hwclock</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
162 </para></listitem>
163 </varlistentry>
164
165 <varlistentry>
166 <term><command>set-ntp [BOOL]</command></term>
167
2fc4f5bd 168 <listitem><para>Takes a boolean argument. Controls whether
8731be1a
LP
169 network time synchronization is active and enabled (if
170 available). This enables and starts, or disables and stops the
171 <filename>systemd-timesyncd.service</filename> unit. It does
172 not affect the state of any other, unrelated network time
173 synchronization services that might be installed on the
174 system. This command is hence mostly equivalent to:
175 <command>systemctl enable --now
176 systemd-timesyncd.service</command> and <command>systemctl
177 disable --now systemd-timesyncd.service</command>, but is
178 protected by a different access policy.</para>
179
180 <para>Note that even if time synchronization is turned off
81eb21b9 181 with this command, another unrelated system service might
b938cb90
JE
182 still synchronize the clock with the network. Also note that,
183 strictly speaking,
8731be1a 184 <filename>systemd-timesyncd.service</filename> does more than
b938cb90 185 just network time synchronization, as it ensures a monotonic
8731be1a
LP
186 clock on systems without RTC even if no network is
187 available. See
188 <citerefentry><refentrytitle>systemd-timesyncd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
189 for details about this.</para></listitem>
798d3a52
ZJS
190 </varlistentry>
191
192 </variablelist>
193
194 </refsect1>
195
196 <refsect1>
197 <title>Exit status</title>
198
199 <para>On success, 0 is returned, a non-zero failure
200 code otherwise.</para>
201 </refsect1>
202
203 <xi:include href="less-variables.xml" />
204
205 <refsect1>
206 <title>Examples</title>
207 <para>Show current settings:
208 <programlisting>$ timedatectl
57506e7d
LP
209 Local time: Di 2015-04-07 16:26:56 CEST
210 Universal time: Di 2015-04-07 14:26:56 UTC
211 RTC time: Di 2015-04-07 14:26:56
212 Time zone: Europe/Berlin (CEST, +0200)
b90930c7 213 Network time on: yes
57506e7d
LP
214NTP synchronized: yes
215 RTC in local TZ: no</programlisting>
798d3a52 216 </para>
be1015dd 217
b90930c7 218 <para>Enable network time synchronization:
798d3a52 219 <programlisting>$ timedatectl set-ntp true
be1015dd
ZJS
220==== AUTHENTICATING FOR org.freedesktop.timedate1.set-ntp ===
221Authentication is required to control whether network time synchronization shall be enabled.
222Authenticating as: user
223Password: ********
9fccdb0f 224==== AUTHENTICATION COMPLETE ===</programlisting>
be1015dd 225
57506e7d
LP
226 <programlisting>$ systemctl status systemd-timesyncd.service
227● systemd-timesyncd.service - Network Time Synchronization
12b42c76 228 Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled)
57506e7d
LP
229 Active: active (running) since Mo 2015-03-30 14:20:38 CEST; 5s ago
230 Docs: man:systemd-timesyncd.service(8)
231 Main PID: 595 (systemd-timesyn)
232 Status: "Using Time Server 216.239.38.15:123 (time4.google.com)."
233 CGroup: /system.slice/systemd-timesyncd.service
12b42c76 234 └─595 /usr/lib/systemd/systemd-timesyncd
9fccdb0f 235...</programlisting>
798d3a52
ZJS
236 </para>
237 </refsect1>
238
239 <refsect1>
240 <title>See Also</title>
241 <para>
242 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
243 <citerefentry project='man-pages'><refentrytitle>hwclock</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
244 <citerefentry project='man-pages'><refentrytitle>date</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
245 <citerefentry><refentrytitle>localtime</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
246 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
247 <citerefentry><refentrytitle>systemd-timedated.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
ff5921ba 248 <citerefentry><refentrytitle>systemd-timesyncd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
798d3a52
ZJS
249 <citerefentry><refentrytitle>systemd-firstboot</refentrytitle><manvolnum>1</manvolnum></citerefentry>
250 </para>
251 </refsect1>
6d0274f1
LP
252
253</refentry>