centos 内网校时
 选中某台机器 ,如果机器不能连接外网:
1、先对此机器设置正确的时区和时间
时区:
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
或者
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
时间,设置
date 010318242008(月日时分年)(完整书写)
2、设置硬件时间,使其于上面设置的系统时间通步
hwclock --systohc
 
如果机器能连接外网 :
1、
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
或者
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
ntpdate pool.ntp.org
2、hwclock --systohc
 
然后,在此台机器上开启ntp server
安装服务:yum -y install ntp
开机启动:chkconfig ntpd on
启动服务:service ntpd start
 
在内网中其他不能连接外网的机器,就可以此ntp server上面的时间来较准了。
 
定时较准时间:
# crontab -e
//打开linux定时计划任务
0 23 * * * /usr/sbin/ntpdate 210.72.145.44
//时间格式如下:如果23改为0-23/2 就表示每隔2小时执行一次
* * * * * *
| | | | | |
| | | | | +-- Year (range: 1900-3000)
| | | | +---- Day of the Week (range: 1-7, 1 standing for Monday)
| | | +------ Month of the Year (range: 1-12)
| | +-------- Day of the Month (range: 1-31)
| +---------- Hour (range: 0-23)
+------------ Minute (range: 0-59)
   1、先对此机器设置正确的时区和时间
时区:
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
或者
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
时间,设置
date 010318242008(月日时分年)(完整书写)
2、设置硬件时间,使其于上面设置的系统时间通步
hwclock --systohc
如果机器能连接外网 :
1、
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
或者
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
ntpdate pool.ntp.org
2、hwclock --systohc
然后,在此台机器上开启ntp server
安装服务:yum -y install ntp
开机启动:chkconfig ntpd on
启动服务:service ntpd start
在内网中其他不能连接外网的机器,就可以此ntp server上面的时间来较准了。
定时较准时间:
# crontab -e
//打开linux定时计划任务
0 23 * * * /usr/sbin/ntpdate 210.72.145.44
//时间格式如下:如果23改为0-23/2 就表示每隔2小时执行一次
* * * * * *
| | | | | |
| | | | | +-- Year (range: 1900-3000)
| | | | +---- Day of the Week (range: 1-7, 1 standing for Monday)
| | | +------ Month of the Year (range: 1-12)
| | +-------- Day of the Month (range: 1-31)
| +---------- Hour (range: 0-23)
+------------ Minute (range: 0-59)
相关推荐
  changecan    2020-11-19  
   ECSHOP专属建设    2020-11-13  
   88427810    2020-11-02  
   步知道    2020-10-27  
   Junzizhiai    2020-10-10  
   jackalwb    2020-10-05  
   小网管    2020-09-03  
   shiwenqiang    2020-09-14  
   85251846    2020-09-14  
   summerinsist    2020-08-21  
   87901735    2020-08-19  
   PinkBean    2020-08-11  
   85407718    2020-08-09  
   MichelinMessi    2020-07-30  
   suosuo    2020-07-28  
   CARBON    2020-07-28  
   lizhengfa    2020-07-27  
   88427810    2020-07-26