Linux   发布时间:2022-04-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了redhat – / etc / localtime应该是符号链接还是文件?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

当我第一次安装RHEL系统时,我选择了一个时区.检查/ etc / localtime,我看到这是/usr/share / zoneinfo中的一个文件的副本. 但是,当我考虑更改系统上的时区时,我发现在复制新文件和创建符号链接之间存在分歧. 什么是最佳实践?符号链接还是复制? 另外:是否有人有解决方案来确定系统当前设置的时区? / etc / sysconfig / clock中的信息可能不正确
当我第一次安装RHEL系统时,我选择了一个时区.检查/ etc / localtime,我看到这是/usr/share / zoneinfo中的一个文件的副本.

但是,当我考虑更改系统上的时区时,我发现在复制新文件和创建符号链接之间存在分歧.

什么是最佳实践?符号链接还是复制?

另外:是否有人有解决方案来确定系统当前设置的时区? / etc / sysconfig / clock中的信息可能不正确.

解决方法

根据 this documentation,它应该是一个象征性的链接
Name

localtime — Local timezone configuration file
Synopsis

/etc/localtime -> ../usr/share/zoneinfo/…
Description

The /etc/localtime file configures the system-wide timezone of the local system that is used by applications for presentation to the user. It should be an absolute or relative symbolic link pointing to /usr/share/zoneinfo/,followed by a timezone identifier such as "Europe/Berlin" or "Etc/UTC". The resulting link should lead to the corresponding binary tzfile(5) timezone data for the configured timezone.

Because the timezone identifier is extracted from the symlink target name of /etc/localtime,this file may not be a normal file or hardlink.

The timezone may be overridden for individual programs by using the TZ environment variable. See environ(7).

You may use timedatectl(1) to change the settings of this file from the command line during runtime. Use systemd-firstboot(1) to initialize the time zone on mounted (but not booted) system images.

为了确定时区,可以发布the following command

[vagrant@localhost ~]$cat /etc/sysconfig/clock
ZONE="UTC"

大佬总结

以上是大佬教程为你收集整理的redhat – / etc / localtime应该是符号链接还是文件?全部内容,希望文章能够帮你解决redhat – / etc / localtime应该是符号链接还是文件?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: