修改操作系统时间:
centos6:
0 1 2 3 4 5 6 |
$ cat /etc/sysconfig/clock ZONE="Asia/Shanghai" UTC=false ARC=false $ ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime $ ntpdate time.windows.com $ /sbin/hwclock --systohc |
centos7:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
$ timedatectl set-timezone UTC $ timedatectl Local time: Wed 2018-04-11 01:31:16 UTC Universal time: Wed 2018-04-11 01:31:16 UTC RTC time: Wed 2018-04-11 01:31:16 Time zone: UTC (UTC, +0000) NTP enabled: n/a NTP synchronized: no RTC in local TZ: no DST active: n/a $ timedatectl set-timezone Asia/Shanghai $ timedatectl Local time: Wed 2018-04-11 09:33:37 CST Universal time: Wed 2018-04-11 01:33:37 UTC RTC time: Wed 2018-04-11 01:33:37 Time zone: Asia/Shanghai (CST, +0800) NTP enabled: n/a NTP synchronized: no RTC in local TZ: no DST active: n/a $ timedatectl list-timezones #列出所有时区 $ timedatectl set-local-rtc yes #本地时间 $ timedatectl set-local-rtc no #utc时间 |
参考文档:
1:http://www.361way.com/centos7-timedatectl/3813.html SourceByrd's Weblog-https://note.t4x.org/basic/centos-change-system-time/
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!