timedatectl — Control the system time and date

Posted jacen789

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了timedatectl — Control the system time and date相关的知识,希望对你有一定的参考价值。

timedatectl --help 的执行结果如下:

timedatectl [OPTIONS...] COMMAND ...

Query or change system time and date settings.

  -h --help                Show this help message
     --version             Show package version
     --no-pager            Do not pipe output into a pager
     --no-ask-password     Do not prompt for password
  -H --host=[[email protected]]HOST    Operate on remote host
  -M --machine=CONTAINER   Operate on local container
     --adjust-system-clock Adjust system clock when changing local RTC mode

Commands:
  status                   Show current time settings
  set-time TIME            Set system time
  set-timezone ZONE        Set system time zone
  list-timezones           Show known time zones
  set-local-rtc BOOL       Control whether RTC is in local time
  set-ntp BOOL             Enable or disable network time synchronization

更详细的参数解释:

The following options are understood:

--no-ask-password
    Do not query the user for authentication for privileged operations.

--adjust-system-clock
    If set-local-rtc 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.

-H, --host=
    Execute the operation remotely. Specify a hostname, or a username and hostname
    separated by "@", to connect to. The hostname may optionally be suffixed by a
    container name, separated by ":", 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 machinectl -H HOST.

-M, --machine=
    Execute operation on a local container. Specify a container name to connect to.

-h, --help
    Print a short help text and exit.

--version
    Print a short version string and exit.

--no-pager
    Do not pipe output into a pager.

The following commands are understood:

status
    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 systemd-timesyncd.service unit is enabled. Even if this command
    shows the status as off, a different service might still synchronize the clock with
    the network.

set-time [TIME]
    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".

set-timezone [TIMEZONE]
    Set the system time zone to the specified value. Available timezones can be listed
    with list-timezones. If the RTC is configured to be in the local time, this will also
    update the RTC time. This call will alter the /etc/localtime symlink. See localtime(5)
    for more information.

list-timezones
    List available time zones, one per line. Entries from the list can be set as the
    system timezone with set-timezone.

set-local-rtc [BOOL]
    Takes a boolean argument. If "0", the system is configured to maintain the RTC in
    universal time. If "1", 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 --adjust-system-clock is passed (see above). This
    command will change the 3rd line of /etc/adjtime, as documented in hwclock(8).

set-ntp [BOOL]
    Takes a boolean argument. Controls whether network time synchronization is active and
    enabled (if available). This enables and starts, or disables and stops the
    systemd-timesyncd.service unit. It does not affect the state of any other, unrelated
    network time synchronization services that might be installed on the system. This
    command is hence mostly equivalent to: systemctl enable --now
    systemd-timesyncd.service and systemctl disable --now systemd-timesyncd.service, but
    is protected by a different access policy.

    Note that even if time synchronization is turned off with this command, another
    unrelated system service might still synchronize the clock with the network. Also note
    that, strictly speaking, systemd-timesyncd.service does more than just network time
    synchronization, as it ensures a monotonic clock on systems without RTC even if no
    network is available. See systemd-timesyncd.service(8) for details about this.

 

以上是关于timedatectl — Control the system time and date的主要内容,如果未能解决你的问题,请参考以下文章

embody the data item with the ability to control access to itself

How to Install The Alpha Control Packages.

P4 Runtime - Putting the Control Plane in Charge of the Forwarding Plane

Vue3跨域问题 [The value of the ‘Access-Control-Allow-Origin‘ header in the response must not be the..]

Visual StudioThe project appears to be under source control, but the associated source control plu(代

转 11g Grid Control: Overview of the EMCTL Options Available for Managing the Agent