{"id":5121,"date":"2012-07-14T13:42:02","date_gmt":"2012-07-14T18:42:02","guid":{"rendered":"http:\/\/jianmingli.com\/wp\/?p=5121"},"modified":"2012-08-08T10:30:00","modified_gmt":"2012-08-08T15:30:00","slug":"linux-sync-time-with-ntpdate","status":"publish","type":"post","link":"https:\/\/jianmingli.com\/wp\/?p=5121","title":{"rendered":"Linux: Sync Time with ntpdate"},"content":{"rendered":"<div class='toc wptoc'>\n<h2>Contents<\/h2>\n<ol class='toc-odd level-1'>\n\t<li>\n\t\t<a href=\"#Sync_Time_using_ntpdate\">Sync Time using <em>ntpdate<\/em><\/a>\n\t\t<ol class='toc-even level-2'>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Manual_Sync\">Manual Sync<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Setup_ntpd_Server\">Setup ntpd Server<\/a>\n\t\t\t<\/li>\n\t\t<\/ol>\n\t<li>\n\t\t<a href=\"#Sync_Time_using_Linux_Desktop\">Sync Time using Linux Desktop<\/a>\n\t<\/li>\n\t<li>\n\t\t<a href=\"#Issues\">Issues<\/a>\n\t\t<ol class='toc-even level-2'>\n\t\t\t<li>\n\t\t\t\t<a href=\"#NTP_socket_is_in_use\">NTP socket is in use<\/a>\n\t\t\t<\/li>\n<\/ol>\n<\/ol>\n<\/ol>\n<\/div>\n<div class='wptoc-end'>&nbsp;<\/div>\n<span id=\"Sync_Time_using_ntpdate\"><h2>Sync Time using <em>ntpdate<\/em><\/h2><\/span>\n<span id=\"Manual_Sync\"><h3>Manual Sync<\/h3><\/span>\n<pre lang=\"bash\">\r\n# sudo as root\r\nsudo su -\r\n\r\n# Stop ntpd\r\nservice ntpd stop\r\n\r\n# Sync time\r\nntpdate pool.ntp.org\r\n\r\n# Start ntpd\r\nservice ntpd start\r\n<\/pre>\n<span id=\"Setup_ntpd_Server\"><h3>Setup ntpd Server<\/h3><\/span>\n<pre lang=\"bash\">\r\nvi \/etc\/ntp.conf\r\n\r\n# Add an entry, e.g. server pool.ntp.org\r\n# Multiple time servers are more accurate:\r\nserver 0.rhel.pool.ntp.org\r\nserver 1.rhel.pool.ntp.org\r\nserver 2.rhel.pool.ntp.org\r\n<\/pre>\n<p>* Turn on ntp service<\/p>\n<pre lang=\"bash\">\r\nchkconfig ntpd on\r\nservice ntpd start\r\n<\/pre>\n<p>* For more sophisticated uses, please see <a href=\"http:\/\/articles.slicehost.com\/2010\/11\/8\/using-ntp-to-sync-time-on-rhel\">this post<\/a>.<\/p>\n<span id=\"Sync_Time_using_Linux_Desktop\"><h2>Sync Time using Linux Desktop<\/h2><\/span>\n<span id=\"\"><h6><a href=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/07\/linux_sys_datetime1.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/07\/linux_sys_datetime1-300x121.jpg\" alt=\"\" title=\"linux_sys_datetime1\" width=\"300\" height=\"121\" class=\"aligncenter size-medium wp-image-5411\" srcset=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/07\/linux_sys_datetime1-300x121.jpg 300w, https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/07\/linux_sys_datetime1.jpg 566w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/h6><\/span>\n<span id=\"_1\"><h6><a href=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/07\/linux_sys_datetime2.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/07\/linux_sys_datetime2-256x300.jpg\" alt=\"\" title=\"linux_sys_datetime2\" width=\"256\" height=\"300\" class=\"aligncenter size-medium wp-image-5412\" srcset=\"https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/07\/linux_sys_datetime2-256x300.jpg 256w, https:\/\/jianmingli.com\/wp\/wp-content\/uploads\/2012\/07\/linux_sys_datetime2.jpg 514w\" sizes=\"auto, (max-width: 256px) 100vw, 256px\" \/><\/a><\/h6><\/span>\n<span id=\"Issues\"><h2>Issues<\/h2><\/span>\n<span id=\"NTP_socket_is_in_use\"><h3>NTP socket is in use<\/h3><\/span>\n<p>* Error message:<\/p>\n<pre lang=\"bash\">\r\nthe NTP socket is in use, exiting\r\n<\/pre>\n<p>* Cause:<br \/>\n&#8211; NTP server is running.<br \/>\n* Fix:<br \/>\n&#8211; Stop NTP server<\/p>\n<pre lang=\"bash\">\r\n# check ntpd process\r\nps -ef | grep ntpd\r\n\r\n# Stop ntpd if started\r\nservice ntpd stop\r\n\r\n# ntpd process should be gone\r\nps -ef | grep ntpd\r\n\r\n# kill if needed\r\nkillall ntpd\r\n\r\n# now update time manually\r\nntpdate pool.ntp.org\r\n\r\n# turn on ntpd service\r\nchkconfig ntpd on\r\nservice ntpd start\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Sync Time using ntpdate Manual Sync # sudo as root sudo su &#8211; # Stop ntpd service ntpd stop # Sync time ntpdate pool.ntp.org # Start ntpd service ntpd start Setup ntpd Server vi \/etc\/ntp.conf # Add an entry, e.g. &hellip; <a href=\"https:\/\/jianmingli.com\/wp\/?p=5121\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[61],"tags":[160,161,163,162],"class_list":["post-5121","post","type-post","status-publish","format-standard","hentry","category-linux","tag-linux-2","tag-ntp","tag-sync","tag-time"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8cRUO-1kB","_links":{"self":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/5121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5121"}],"version-history":[{"count":13,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/5121\/revisions"}],"predecessor-version":[{"id":5676,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/5121\/revisions\/5676"}],"wp:attachment":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}