Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to write Shell script to realize synchronous Calibration of system time and BIOS time

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report