当我第一次安装RHEL系统时,我select了一个时区。 检查/etc/localtime ,我看到这是来自/usr/share/zoneinfo的其中一个文件的副本。
但是,当我考虑更改系统上的时区时,我发现在复制新文件和创build符号链接之间存在分裂。
什么是公认的最佳实践? 符号链接或复制?
另外:有没有人有一个解决scheme来确定系统当前设置的时区? /etc/sysconfig/clock中的信息可能不正确。
根据这个文件,它应该是一个符号链接:
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.
为了确定时区,可以发出以下命令 :
[vagrant@localhost ~]$ cat /etc/sysconfig/clock ZONE="UTC"
Debian维护者在这个错误报告中解释了他们的select: https : //bugs.debian.org/cgi-bin/bugreport.cgi? bug =726256
摘录:
迈克尔Biebl写道:
通过timedated(org.freedesktop.timedate1或timedatectl)更改时区信息将会使用/ usr / share / zoneinfo中的时区文件的符号链接replace/ etc / localtime。
这意味着该文件将在早期启动时悬挂符号链接,并且可能会错误地为具有单独的/ usr的系统设置时间。