日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

linux下日期時間自動同步設置(rdate,ntpdate兩種方法)

 智慧書倉 2019-05-23

http://blog./archives/6397.html

linux下同步時間,至少有兩種方法:

rdate,ntpdate兩種。centos最小化安裝默認不安裝,先確認已經(jīng)安裝過,否則先安裝。

其中rdate本身是用來獲取遠程時間服務器上時間用的,帶上 -s 參數(shù),就可以將獲取到的時間應用到本地系統(tǒng)。

NAME
       rdate - get the time via the network

SYNOPSIS
       rdate [-p] [-s] [-u] [-l] [-t sec] [host...]

DESCRIPTION
       rdate  connects  to  an  RFC  868 time server over a TCP/IP network, printing the returned time
       and/or setting the system clock.

   OPTIONS
       -p     Print the time returned by the remote machine.

       -s     Set the system time to the returned time.

       -u     Use UDP instead of TCP as the transport.

       -l     Use syslog to output errors (cron.warning) and output (cron.info).

       -t     Set timeout in seconds for every attempt to retreive date.

rdate -s time.nist.gov

ntpdate 本身就是用來同步時間的工具。

示例 :ntpdate ntp.sjtu.edu.cn

NAME
       ntpdate - set the date and time via NTP

       Disclaimer:  The functionality of this program is now available in the ntpd program. See the -q com-
       mand line option in the ntpd - Network Time Protocol (NTP) daemon page. After a suitable  period  of
       mourning, the ntpdate program is to be retired from this distribution

SYNOPSIS
       ntpdate [ -46bBdqsuv ] [ -a key ] [ -e authdelay ] [ -k keyfile ] [ -o version ] [ -p samples ] [ -t
       timeout ] [ -U user_name ] server [ ... ]

DESCRIPTION

[略,具體參看linux man手冊]

日期時間服務器

同步時間,就必須有時間服務器。通常情況下,我們完全沒必要自己搭建,使用公共的時間服務就可以。

參看 國內(nèi)常用NTP服務器地址及IP  http://www.douban.com/note/171309770/

其中國家授時中心的似乎不能用,推薦使用上海交大ntp服務 ntp.sjtu.edu.cn 或美國授時中心 time.nist.gov

上代碼,拷了就可以用

rdate -s time.nist.gov

ntpdate ntp.sjtu.edu.cn

可以加到crontab里定時執(zhí)行。

    本站是提供個人知識管理的網(wǎng)絡存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權內(nèi)容,請點擊一鍵舉報。
    轉藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多