centos / linux automatically updates the network time

Install ntpdate

yum -y install ntpdate

  

View current time

date

  

Synchronize the current time

ntpdate time.nist.gov; #update time 
hwclock -w; #write time to hard disk

  

Join a scheduled task

1. Open crontab 
vi / etc / crontab 

2. Add a scheduled task 
 * * / 48 * * * ntpdate time.nist.gov; hwclock -w;

  

 

Guess you like

Origin www.cnblogs.com/achengmu/p/12713377.html