首页 > 其他 > 详细

时间定时同步

时间:2021-09-03 22:46:06      阅读:17      评论:0      收藏:0      [点我收藏+]

时间定时同步

1.查看时区:timedatectl
2.将硬件时钟调整为与本地时钟一致, 0 为设置为 UTC 时间:timedatectl set-local-rtc 1

timedatectl set-timezone Asia/Shanghai 设置系统时区为上海
3.timedatectl set-ntp no
4.timedatectl set-time ‘2021-01-11 10:00:00‘
5.clock -w
timedatectl set-local-rtc 1

cd /etc/sysconfig/network-scripts
vi ifcfg-eth0


DNS2=172.20.7.9
echo "DNS2=172.20.7.9" >>/etc/sysconfig/network-scripts/ifcfg-eth0
cat /etc/sysconfig/network-scripts/ifcfg-eth0
systemctl restart network
ping ntp.zjhu.edu.cn

yum -y install crontabs
systemctl start crond.service
systemctl enable crond.service
systemctl status  crond.service

crontab -e
0 */2 * * * ntpdate ntp.zjhu.edu.cn
*/1 * * * * /sbin/ntpdate ntp.zjhu.edu.cn

/sbin/ntpdate ntp.zjhu.edu.cn


yum install -y ntpdate
systemctl start ntpdate.service
systemctl status ntpdate.service
systemctl enable ntpdate.service

find / -name CentOS-7.6-x86_64-DVD-1810.iso
mount -o loop  /u01/CentOS-7.6-x86_64-DVD-1810.iso   /mnt
mount -o loop  /u01/bak/CentOS-7.6-x86_64-DVD-1810.iso   /mnt

mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak/

echo "[base]" >> /etc/yum.repos.d/123.repo
echo "name=123" >> /etc/yum.repos.d/123.repo
echo "baseurl=file:///mnt" >> /etc/yum.repos.d/123.repo
echo "gpgcheck=0" >> /etc/yum.repos.d/123.repo
echo "enable=1" >> /etc/yum.repos.d/123.repo

yum makecache

时间定时同步

原文:https://www.cnblogs.com/khtt/p/15223625.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!