systemd/man/timedatectl.html
2015-06-22 17:16:03 +02:00

125 lines
13 KiB
HTML

<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>timedatectl</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><style>
a.headerlink {
color: #c60f0f;
font-size: 0.8em;
padding: 0 4px 0 4px;
text-decoration: none;
visibility: hidden;
}
a.headerlink:hover {
background-color: #c60f0f;
color: white;
}
h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
visibility: visible;
}
</style><a href="index.html">Index </a>·
<a href="systemd.directives.html">Directives </a>·
<a href="../python-systemd/index.html">Python </a>·
<span style="float:right">systemd 221</span><hr><div class="refentry"><a name="timedatectl"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>timedatectl — Control the system time and date</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">timedatectl [OPTIONS...] {COMMAND}</code> </p></div></div><div class="refsect1"><a name="idm47599435527872"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description"></a></h2><p><span class="command"><strong>timedatectl</strong></span> may be used to query and
change the system clock and its settings.</p><p>Use
<a href="systemd-firstboot.html"><span class="citerefentry"><span class="refentrytitle">systemd-firstboot</span>(1)</span></a>
to initialize the system time zone for mounted (but not booted)
system images.</p></div><div class="refsect1"><a name="idm47599430625248"></a><h2 id="Options">Options<a class="headerlink" title="Permalink to this headline" href="#Options"></a></h2><p>The following options are understood:</p><div class="variablelist"><dl class="variablelist"><dt id="--no-ask-password"><span class="term"><code class="option">--no-ask-password</code></span><a class="headerlink" title="Permalink to this term" href="#--no-ask-password"></a></dt><dd><p>Do not query the user for authentication for
privileged operations.</p></dd><dt id="--adjust-system-clock"><span class="term"><code class="option">--adjust-system-clock</code></span><a class="headerlink" title="Permalink to this term" href="#--adjust-system-clock"></a></dt><dd><p>If <span class="command"><strong>set-local-rtc</strong></span> is invoked
and this option is passed, the system clock is synchronized
from the RTC again, taking the new setting into account.
Otherwise, the RTC is synchronized from the system
clock.</p></dd><dt id="-H"><span class="term"><code class="option">-H</code>, </span><span class="term"><code class="option">--host=</code></span><a class="headerlink" title="Permalink to this term" href="#-H"></a></dt><dd><p><a name="host-text"></a>Execute the operation remotely. Specify a hostname, or a
username and hostname separated by "<code class="literal">@</code>", to
connect to. The hostname may optionally be suffixed by a
container name, separated by "<code class="literal">:</code>", which
connects directly to a specific container on the specified
host. This will use SSH to talk to the remote machine manager
instance. Container names may be enumerated with
<span class="command"><strong>machinectl -H
<em class="replaceable"><code>HOST</code></em></strong></span>.</p></dd><dt id="-M"><span class="term"><code class="option">-M</code>, </span><span class="term"><code class="option">--machine=</code></span><a class="headerlink" title="Permalink to this term" href="#-M"></a></dt><dd><p><a name="machine-text"></a>Execute operation on a local container. Specify a
container name to connect to.</p></dd><dt id="-h"><span class="term"><code class="option">-h</code>, </span><span class="term"><code class="option">--help</code></span><a class="headerlink" title="Permalink to this term" href="#-h"></a></dt><dd><p><a name="help-text"></a>Print a short help text and exit.
</p></dd><dt id="--version"><span class="term"><code class="option">--version</code></span><a class="headerlink" title="Permalink to this term" href="#--version"></a></dt><dd><p><a name="version-text"></a>Print a short version string and exit.</p></dd><dt id="--no-pager"><span class="term"><code class="option">--no-pager</code></span><a class="headerlink" title="Permalink to this term" href="#--no-pager"></a></dt><dd><p>Do not pipe output into a pager.</p></dd></dl></div><p>The following commands are understood:</p><div class="variablelist"><dl class="variablelist"><dt id="status"><span class="term"><span class="command"><strong>status</strong></span></span><a class="headerlink" title="Permalink to this term" href="#status"></a></dt><dd><p>Show current settings of the system clock and
RTC, including whether network time synchronization is
on. Note that whether network time synchronization is on
simply reflects whether the
<code class="filename">systemd-timesyncd.service</code> unit is
enabled. Even if this command shows the status as off a
different service might still synchronize the clock with the
network.</p></dd><dt id="set-time [TIME]"><span class="term"><span class="command"><strong>set-time [TIME]</strong></span></span><a class="headerlink" title="Permalink to this term" href="#set-time%20%5BTIME%5D"></a></dt><dd><p>Set the system clock to the specified time.
This will also update the RTC time accordingly. The time may
be specified in the format "2012-10-30
18:17:16".</p></dd><dt id="set-timezone [TIMEZONE]"><span class="term"><span class="command"><strong>set-timezone [TIMEZONE]</strong></span></span><a class="headerlink" title="Permalink to this term" href="#set-timezone%20%5BTIMEZONE%5D"></a></dt><dd><p>Set the system time zone to the specified
value. Available timezones can be listed with
<span class="command"><strong>list-timezones</strong></span>. If the RTC is configured to
be in the local time, this will also update the RTC time. This
call will alter the <code class="filename">/etc/localtime</code>
symlink. See
<a href="localtime.html"><span class="citerefentry"><span class="refentrytitle">localtime</span>(5)</span></a>
for more information.</p></dd><dt id="list-timezones"><span class="term"><span class="command"><strong>list-timezones</strong></span></span><a class="headerlink" title="Permalink to this term" href="#list-timezones"></a></dt><dd><p>List available time zones, one per line.
Entries from the list can be set as the system timezone with
<span class="command"><strong>set-timezone</strong></span>.</p></dd><dt id="set-local-rtc [BOOL]"><span class="term"><span class="command"><strong>set-local-rtc [BOOL]</strong></span></span><a class="headerlink" title="Permalink to this term" href="#set-local-rtc%20%5BBOOL%5D"></a></dt><dd><p>Takes a boolean argument. If
"<code class="literal">0</code>", the system is configured to maintain the
RTC in universal time. If "<code class="literal">1</code>", it will
maintain the RTC in local time instead. Note that maintaining
the RTC in the local timezone is not fully supported and will
create various problems with time zone changes and daylight
saving adjustments. If at all possible, keep the RTC in UTC
mode. Note that invoking this will also synchronize the RTC
from the system clock, unless
<code class="option">--adjust-system-clock</code> is passed (see above).
This command will change the 3rd line of
<code class="filename">/etc/adjtime</code>, as documented in
<a href="http://man7.org/linux/man-pages/man8/hwclock.8.html"><span class="citerefentry"><span class="refentrytitle">hwclock</span>(8)</span></a>.
</p></dd><dt id="set-ntp [BOOL]"><span class="term"><span class="command"><strong>set-ntp [BOOL]</strong></span></span><a class="headerlink" title="Permalink to this term" href="#set-ntp%20%5BBOOL%5D"></a></dt><dd><p>Takes a boolean argument. Controls whether
network time synchronization is enabled (if available). This
enables or disables the
<code class="filename">systemd-timesyncd.service</code> unit. Note that
even if this command turns time synchronization off a
different system service might still synchronize the clock
with the network.</p></dd></dl></div></div><div class="refsect1"><a name="idm47599430596560"></a><h2 id="Exit status">Exit status<a class="headerlink" title="Permalink to this headline" href="#Exit%20status"></a></h2><p>On success, 0 is returned, a non-zero failure
code otherwise.</p></div><div class="refsect1"><a name="idm47599418786976"></a><h2 id="Environment">Environment<a class="headerlink" title="Permalink to this headline" href="#Environment"></a></h2><div class="variablelist"><dl class="variablelist"><dt id="$SYSTEMD_PAGER"><span class="term"><code class="varname">$SYSTEMD_PAGER</code></span><a class="headerlink" title="Permalink to this term" href="#%24SYSTEMD_PAGER"></a></dt><dd><p>Pager to use when
<code class="option">--no-pager</code> is not given;
overrides <code class="varname">$PAGER</code>. Setting
this to an empty string or the value
"<code class="literal">cat</code>" is equivalent to passing
<code class="option">--no-pager</code>.</p></dd><dt id="$SYSTEMD_LESS"><span class="term"><code class="varname">$SYSTEMD_LESS</code></span><a class="headerlink" title="Permalink to this term" href="#%24SYSTEMD_LESS"></a></dt><dd><p>Override the default
options passed to
<span class="command"><strong>less</strong></span>
("<code class="literal">FRSXMK</code>").</p></dd></dl></div></div><div class="refsect1"><a name="idm47599430594912"></a><h2 id="Examples">Examples<a class="headerlink" title="Permalink to this headline" href="#Examples"></a></h2><p>Show current settings:
</p><pre class="programlisting">$ timedatectl
Local time: Di 2015-04-07 16:26:56 CEST
Universal time: Di 2015-04-07 14:26:56 UTC
RTC time: Di 2015-04-07 14:26:56
Time zone: Europe/Berlin (CEST, +0200)
Network time on: yes
NTP synchronized: yes
RTC in local TZ: no</pre><p>
</p><p>Enable network time synchronization:
</p><pre class="programlisting">$ timedatectl set-ntp true
==== AUTHENTICATING FOR org.freedesktop.timedate1.set-ntp ===
Authentication is required to control whether network time synchronization shall be enabled.
Authenticating as: user
Password: ********
==== AUTHENTICATION COMPLETE ===</pre><p>
</p><pre class="programlisting">$ systemctl status systemd-timesyncd.service
● systemd-timesyncd.service - Network Time Synchronization
Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled)
Active: active (running) since Mo 2015-03-30 14:20:38 CEST; 5s ago
Docs: man:systemd-timesyncd.service(8)
Main PID: 595 (systemd-timesyn)
Status: "Using Time Server 216.239.38.15:123 (time4.google.com)."
CGroup: /system.slice/systemd-timesyncd.service
└─595 /usr/lib/systemd/systemd-timesyncd
...</pre><p>
</p></div><div class="refsect1"><a name="idm47599430590256"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also"></a></h2><p>
<a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
<a href="http://man7.org/linux/man-pages/man8/hwclock.8.html"><span class="citerefentry"><span class="refentrytitle">hwclock</span>(8)</span></a>,
<a href="http://man7.org/linux/man-pages/man1/date.1.html"><span class="citerefentry"><span class="refentrytitle">date</span>(1)</span></a>,
<a href="localtime.html"><span class="citerefentry"><span class="refentrytitle">localtime</span>(5)</span></a>,
<a href="systemctl.html"><span class="citerefentry"><span class="refentrytitle">systemctl</span>(1)</span></a>,
<a href="systemd-timedated.service.html"><span class="citerefentry"><span class="refentrytitle">systemd-timedated.service</span>(8)</span></a>,
<a href="systemd-timesyncd.service.html"><span class="citerefentry"><span class="refentrytitle">systemd-timesyncd.service</span>(8)</span></a>,
<a href="systemd-firstboot.html"><span class="citerefentry"><span class="refentrytitle">systemd-firstboot</span>(1)</span></a>
</p></div></div></body></html>