centos同步时间
前提: 安装系统的时候, date时区设置为 shanghai
# service ntpd stop
# chkconfig ntpd off
# hwclock
# date
# ntpdate cn.pool.ntp.org
# hwclock --systohc 等同于 hwclock -w ,将系统时间写入BIOS时间
小型脚本:
# crontab -e 脚本内容 , 每分钟执行1次校时
*/1 * * * * /usr/sbin/ntpdate cn.pool.ntp.org
*/1 * * * * /sbin/hwclock --systohc
开启脚本自动执行,激活任务计划功能(配置文件)
# service crond start
# chkconfig crond on