{"id":1931,"date":"2010-12-08T15:13:34","date_gmt":"2010-12-08T15:13:34","guid":{"rendered":"http:\/\/www.icocean.com\/blog\/?p=1931"},"modified":"2010-12-08T15:24:03","modified_gmt":"2010-12-08T15:24:03","slug":"%E4%B8%BA%E4%BB%80%E4%B9%88%E4%B8%8D%E7%94%A8ntpdate%EF%BC%8C%E8%80%8C%E8%A6%81%E7%94%A8ntpd","status":"publish","type":"post","link":"https:\/\/www.icocean.com\/blog\/?p=1931","title":{"rendered":"\u4e3a\u4ec0\u4e48\u4e0d\u7528ntpdate\uff0c\u800c\u8981\u7528ntpd"},"content":{"rendered":"<p>\u65f6\u949f\u7684\u8dc3\u53d8\uff0c\u6709\u65f6\u5019\u4f1a\u5bfc\u81f4\u5f88\u4e25\u91cd\u7684\u95ee\u9898\u3002\u8bb8\u591a\u5e94\u7528\u7a0b\u5e8f\u4f9d\u8d56\u8fde\u7eed\u7684\u65f6\u949f\u2014\u2014\u6bd5\u7adf\uff0c\u8fd9\u662f\u4e00\u9879\u5e38\u89c1\u7684\u5047\u5b9a\uff0c\u5373\uff0c\u53d6\u5f97\u7684\u65f6\u95f4\u662f\u7ebf\u6027\u7684\uff0c\u4e00\u4e9b\u64cd\u4f5c\uff0c\u4f8b\u5982\u6570\u636e\u5e93\u4e8b\u52a1\uff0c \u901a\u5e38\u4f1a\u5730\u4f9d\u8d56\u8fd9\u6837\u7684\u4e8b\u5b9e\uff1a\u65f6\u95f4\u4e0d\u4f1a\u5f80\u56de\u8df3\u8dc3\u3002<\/p>\n<p>\u4e0d\u5e78\u7684\u662f\uff0cntpdate\u8c03\u6574\u65f6\u95f4\u7684\u65b9\u5f0f\u5c31\u662f\u6211\u4eec\u6240\u8bf4\u7684\u201d\u8dc3\u53d8\u201c\uff1a\u5728\u83b7\u5f97\u4e00\u4e2a\u65f6\u95f4\u4e4b \u540e\uff0cntpdate\u4f7f\u7528settimeofday(2)\u8bbe\u7f6e\u7cfb\u7edf\u65f6\u95f4\uff0c\u8fd9\u6709\u51e0\u4e2a\u975e\u5e38\u660e\u663e\u7684\u95ee\u9898\uff1a<\/p>\n<p>\u7b2c\u4e00\uff0c\u8fd9\u6837\u505a\u4e0d\u5b89\u5168\u3002ntpdate\u7684\u8bbe \u7f6e\u4f9d\u8d56\u4e8entp\u670d\u52a1\u5668\u7684\u5b89\u5168\u6027\uff0c\u653b\u51fb\u8005\u53ef\u4ee5\u5229\u7528\u4e00\u4e9b\u8f6f\u4ef6\u8bbe\u8ba1\u4e0a\u7684\u7f3a\u9677\uff0c\u62ff\u4e0bntp\u670d\u52a1\u5668\u5e76\u4ee4\u4e0e\u5176\u540c\u6b65\u7684\u670d\u52a1\u5668\u6267\u884c\u67d0\u4e9b\u6d88\u8017\u6027\u7684\u4efb\u52a1\u3002\u7531\u4e8entpdate\u91c7 \u7528\u7684\u65b9\u5f0f\u662f\u8df3\u53d8\uff0c\u8ddf\u968f\u5b83\u7684\u670d\u52a1\u5668\u65e0\u6cd5\u77e5\u9053\u662f\u5426\u53d1\u751f\u4e86\u5f02\u5e38\uff08\u65f6\u95f4\u4e0d\u4e00\u6837\u7684\u65f6\u5019\uff0c\u552f\u4e00\u7684\u529e\u6cd5\u662f\u4ee5\u670d\u52a1\u5668\u4e3a\u51c6\uff09\u3002<\/p>\n<p>\u7b2c\u4e8c\uff0c\u8fd9\u6837\u505a\u4e0d\u7cbe\u786e\u3002\u4e00\u65e6 ntp\u670d\u52a1\u5668\u5b95\u673a\uff0c\u8ddf\u968f\u5b83\u7684\u670d\u52a1\u5668\u4e5f\u5c31\u4f1a\u65e0\u6cd5\u540c\u6b65\u65f6\u95f4\u3002\u4e0e\u6b64\u4e0d\u540c\uff0cntpd\u4e0d\u4ec5\u80fd\u591f\u6821\u51c6\u8ba1\u7b97\u673a\u7684\u65f6\u95f4\uff0c\u800c\u4e14\u80fd\u591f\u6821\u51c6\u8ba1\u7b97\u673a\u7684\u65f6\u949f\u3002<\/p>\n<p>\u7b2c\u4e09\uff0c \u8fd9\u6837\u505a\u4e0d\u591f\u4f18\u96c5\u3002\u7531\u4e8e\u662f\u8df3\u53d8\uff0c\u800c\u4e0d\u662f\u4f7f\u65f6\u95f4\u53d8\u5feb\u6216\u53d8\u6162\uff0c\u4f9d\u8d56\u65f6\u5e8f\u7684\u7a0b\u5e8f\u4f1a\u51fa\u9519\uff08\u4f8b\u5982\uff0c\u5982\u679cntpdate\u53d1\u73b0\u4f60\u7684\u65f6\u95f4\u5feb\u4e86\uff0c\u5219\u53ef\u80fd\u4f1a\u7ecf\u5386\u4e24\u4e2a\u76f8\u540c\u7684\u65f6\u523b\uff0c \u5bf9\u67d0\u4e9b\u5e94\u7528\u800c\u8a00\uff0c\u8fd9\u662f\u81f4\u547d\u7684\uff09\u3002<\/p>\n<p>\u56e0\u800c\uff0c\u552f\u4e00\u4e00\u4e2a\u53ef\u4ee5\u4ee4\u65f6\u95f4\u53d1\u751f\u8df3\u53d8\u7684\u70b9\uff0c\u662f\u8ba1\u7b97\u673a\u521a\u521a\u542f\u52a8\uff0c\u4f46\u8fd8\u6ca1\u6709\u542f\u52a8\u5f88\u591a\u670d\u52a1\u7684\u90a3\u4e2a\u65f6\u5019\u3002\u5176\u4f59\u7684\u65f6 \u5019\uff0c\u7406\u60f3\u7684\u505a\u6cd5\u662f\u4f7f\u7528ntpd\u6765\u6821\u51c6\u65f6\u949f\uff0c\u800c\u4e0d\u662f\u8c03\u6574\u8ba1\u7b97\u673a\u65f6\u949f\u4e0a\u7684\u65f6\u95f4\u3002<\/p>\n<p>=======<br \/>dovecot, \u7ecf\u5e38\u4f1a\u5728ntpdate\u4fee\u6539\u65f6\u95f4\u540e,\u8fdb\u7a0b\u4f1a\u6b7b\u6389,\u4e14\u4e0d\u80fd\u81ea\u52a8\u91cd\u542f. <br \/>\u89e3\u51b3dovecot\u7684\u95ee\u9898\u67092\u4e2a\u65b9\u5f0f,<br \/>1. \u5c06\u6821\u51c6\u65f6\u95f4\u7684\u65b9\u5f0f\u7531 ntpdate \u66f4\u6539\u4e3antpd(\u6b64\u65b9\u5f0f\u4f1a\u6709\u4e00\u4e2adaemon\u5e38\u9a7b\u540e\u53f0)<br \/>2. \u5728\u6bcf\u6b21\u6267\u884cutpdate\u540e,\u5ef6\u8fdf\u4e00\u6bb5\u65f6\u95f4,\u81ea\u52a8\u91cd\u542fdovecot\u670d\u52a1.<br \/>(\u8fd9\u79cd\u65b9\u5f0f\u53ea\u9002\u7528\u4e8e\u90ae\u4ef6\u670d\u52a1\u4e0d\u662f\u5173\u952e\u670d\u52a1\u7684\u60c5\u51b5,\u5982\u679c\u8981\u4fdd\u8bc1dovecot\u7a33\u5b9a\u8fd0\u884c,\u8fd8\u662f\u5efa\u8bae\u91c7\u7528\u7b2c1\u79cd\u65b9\u5f0f)<\/p>\n<p>\u5728ubuntu server\u7684\u811a\u672c\u5982\u4e0b<br \/>sudo nano \/etc\/cron.weekly\/timeupdate<\/p>\n<p>\u7136\u540e\u5199\u5165<br \/><coolcode>#!bin\/sh<br \/>ntpdate cn.pool.ntp.org<\/p>\n<p>#\u811a\u672c\u4f11\u606f120\u79d2,\u7136\u540e\u518d\u7ee7\u7eed.\u4e00\u822c\u6765\u8bf4\u4e00\u4e2a\u661f\u671f\u504f\u5dee120\u79d2\u5df2\u7ecf\u662f\u8db3\u591f\u8db3\u591f\u8db3\u591f\u5927\u7684\u4e86.#<br \/>sleep 120<br \/>service dovecot restart<br \/><\/coolcode><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u65f6\u949f\u7684\u8dc3\u53d8\uff0c\u6709\u65f6\u5019\u4f1a\u5bfc\u81f4\u5f88\u4e25\u91cd\u7684\u95ee\u9898\u3002\u8bb8\u591a\u5e94\u7528\u7a0b\u5e8f\u4f9d\u8d56\u8fde\u7eed\u7684\u65f6\u949f\u2014\u2014\u6bd5\u7adf\uff0c\u8fd9\u662f\u4e00\u9879\u5e38\u89c1\u7684\u5047\u5b9a\uff0c\u5373\uff0c\u53d6\u5f97\u7684\u65f6\u95f4\u662f <a href='https:\/\/www.icocean.com\/blog\/?p=1931' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[434,3095,3094,595,1047],"class_list":["post-1931","post","type-post","status-publish","format-standard","hentry","category-linuxunix","tag-linux","tag-ntpd","tag-ntpdate","tag-ubuntu","tag-1047","category-16-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1931","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1931"}],"version-history":[{"count":0,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1931\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1931"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1931"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1931"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}