How to write Shell script to realize synchronous Calibration of system time and BIOS time
This article mainly introduces "how to write Shell script to realize synchronous calibration of system time and BIOS time". In daily operation, it is believed that many people have doubts about how to write Shell script to realize synchronous calibration of system time and BIOS time. The editor consulted all kinds of materials and sorted out simple and useful operation methods. I hope it will be helpful for you to answer the question of "how to write Shell scripts to achieve system time and BIOS time synchronization calibration"! Next, please follow the editor to study!
The code is as follows:
#! / bin/bash
# NTP Network time Correction script
# run
# NTP server array list
NtpServer= (
[0] = ntp.fudan.edu.cn
[1] = asia.pool.ntp.org
[2] = 210.72.145.44
[3] = 133.100.11.8
[4] = ntp.sjtu.edu.cn
[5] = time.scau.edu.cn
)
# check #
ServerNum= `echo ${# ntpServer [*]} `
NUM=0
For ((iTuno; I > / dev/null 2 > & 1)
If [$?-eq 0]; then
Echo-e "\ e [1bot 32m\ t\ t [success]\ e [0m"
Break
Else
Echo-e "\ e [1x 31m\ t\ t [failure]\ e [0m"
Let NUM++
Fi
Sleep 2
Done
# set BIOS time to be consistent with system time
Hwclock-systohc
At this point, the study on "how to write Shell scripts to synchronize system time and BIOS time" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!