您的位置:首页 > 运维架构 > Linux

关于CentOS设置系统时间命令介绍

2014-06-10 13:46 288 查看
来自 http://www.zdh1909.com/html/Cisco/18945.html
设置时区

方法一:使用setup工具

setup

选择Timezone configuration

选择Asia/Shanghai

空格键勾选上System clock uses UTC

就OK了。

方法二:使用tzselect工具

tzselect

选择亚洲Asia

5

选择国家China

9

选择地区central China

3

确认选择Yes

1

设置好tzselect后,一定要重写/etc/localtime

rm /etc/localtime

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

方法三:直接修改/etc/sysconfig/clock文件

vi /etc/sysconfig/clock

ZONE="Asia/Shanghai"

UTC=true

ARC=false

重写/etc/localtime

rm /etc/localtime

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

二、重启系统使时区生效

reboot

三、更新时间

更新系统时间

ntpdate cn.pool.ntp.org

更新硬件时间

hwclock --systohc

四、crontab定时较对时间

设置crontab定时较对时间

crontab -e

30 1 * * * ntpdate cn.pool.ntp.org ;hwclock --systohc

PS:

ntpdate命令安装

yum -y install ntp

setup工具安装

yum -y install setuptool

crontabs安装

yum -y install gcc gcc-c++ autoconf vixie-cron crontabs
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: