{"id":3072,"date":"2024-05-24T04:57:04","date_gmt":"2024-05-24T04:57:04","guid":{"rendered":"https:\/\/bigboxhost.com\/blog\/?p=3072"},"modified":"2024-05-24T04:58:55","modified_gmt":"2024-05-24T04:58:55","slug":"quickest-way-to-sync-date-time-on-linux-server","status":"publish","type":"post","link":"https:\/\/bigboxhost.com\/blog\/quickest-way-to-sync-date-time-on-linux-server\/","title":{"rendered":"Quickest Way to Sync Date\/Time on Linux Server"},"content":{"rendered":"\n<p>Many times you might have noticed the server time is off-sync.  This can cause issues with logs and scheduled tasks, so it&#8217;s important to keep the server time accurate. One of the quickest ways to sync the date\/time on a Linux server is by using the following command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo date -s \"$(wget -qSO- --max-redirect=0 google.com 2>&amp;1 | grep Date: | cut -d' ' -f5-8)Z\"<\/code><\/pre>\n\n\n\n<p>By this, you can easily update the time without using NTP protocol or ntpupdate commands.<\/p>\n\n\n\n<p>If you want to sync the data\/time on a daily basis, you can do it by adding the following line to your crontab.<\/p>\n\n\n\n<p>To edit crontab, use command.<br><code>sudo crontab -e<br><\/code>On the new line add the following line to your crontab file and save it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>0 0 * * * sudo date -s \"$(wget -qSO- --max-redirect=0 google.com 2>&amp;1 | grep Date: | cut -d' ' -f5-8)Z\"<\/code><\/pre>\n\n\n\n<p>This is to create the cron that will sync your device date and time every day at midnight.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Many times you might have noticed the server time is off-sync. This can cause issues with logs and scheduled tasks, so it&#8217;s important to keep the server time accurate. One of the quickest ways to sync the date\/time on a Linux server is by using the following command. By this, you can easily update the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3074,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"","_seopress_titles_title":"Quickest Way to Sync Date\/Time on Linux Devices","_seopress_titles_desc":"Many times you might have noticed the server time is off-sync. This can cause issues with logs and scheduled tasks, so it's important to keep the server time accurate.","_seopress_robots_index":"","_themeisle_gutenberg_block_has_review":false,"footnotes":""},"categories":[50],"tags":[86,83,84,79,85],"class_list":["post-3072","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-shorts","tag-command","tag-cron","tag-date","tag-sync","tag-time"],"_links":{"self":[{"href":"https:\/\/bigboxhost.com\/blog\/wp-json\/wp\/v2\/posts\/3072","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bigboxhost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bigboxhost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bigboxhost.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bigboxhost.com\/blog\/wp-json\/wp\/v2\/comments?post=3072"}],"version-history":[{"count":2,"href":"https:\/\/bigboxhost.com\/blog\/wp-json\/wp\/v2\/posts\/3072\/revisions"}],"predecessor-version":[{"id":3075,"href":"https:\/\/bigboxhost.com\/blog\/wp-json\/wp\/v2\/posts\/3072\/revisions\/3075"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/bigboxhost.com\/blog\/wp-json\/wp\/v2\/media\/3074"}],"wp:attachment":[{"href":"https:\/\/bigboxhost.com\/blog\/wp-json\/wp\/v2\/media?parent=3072"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bigboxhost.com\/blog\/wp-json\/wp\/v2\/categories?post=3072"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bigboxhost.com\/blog\/wp-json\/wp\/v2\/tags?post=3072"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}