开机后ntpdate 或者 htpdate

FsTy 提交于 周二, 12/22/2015 - 20:47


sudo apt-get install ntpdate

sudo systemctl disable ntp.service

(来自:https://linux.cn/article-5926-1.html   systemctl 命令完全指南)

sudo apt-get remove ntp
tzselect
sudo ntpdate cn.pool.ntp.org

sudo nano /etc/rc.local 

加入sudo ntpdate cn.pool.ntp.org >> /var/log/ntpdate.log &    (root 用户登陆后才会运行/etc/rc.local)

 

--------------------------------------------------------------------------------------------------

cd /tmp

sudo wget  https://codeload.github.com/iridium77/htpdate/zip/master

unzip master

cd ./htpdate-master/
make
sudo make install
sudo htpdate -t -s shop.fsyz.net
date

作者非常友好的写好了 htpdate的开机启动脚本,脚本就在解压目录下的scripts中名为htpdate.init

cd ./scripts
sudo cp htpdate.init /etc/init.d/
sudo chmod 777 htpdate.init
cd /etc/init.d/
sudo insserv htpdate.init
sudo systemctl daemon-reload
sudo service htpdate.init start