ntpdate与hwclock命令
ntpdate与hwclock命令
ntpdate与hwclock命令
通过ntpdate命令获取网络时间并且将其作为硬件时间:
www.2cto.com
/usr/sbin/ntpdate servername/ip && /sbin/hwclock --systohc > /dev/null 2>&1
例: /usr/sbin/ntpdate tw.pool.ntp.org && /sbin/hwclock --systohc > /dev/null 2>&1
通用的servername:
asia.pool.ntp.org
cn.pool.ntp.org
hk.pool.ntp.org
tw.pool.ntp.org
sg.pool.ntp.org
手动设置系统时间:
date -s "time date"
date -s "12:30:00 20130204"
手动设置硬件时间: www.2cto.com
hwclock --set --date="月/日/年 时:分:秒"(通用格式)
hwclock --set --date="2013/02/05 12:30:00" --->不用通用格式也可以
hwclock --set --date="20130205 12:30:00" ---->这样也行
与crontab一起使用时注意crontab的时间是以系统时间为准的!
评论暂时关闭