{"id":1627,"date":"2014-11-30T04:41:46","date_gmt":"2014-11-30T04:41:46","guid":{"rendered":"http:\/\/ixyzero.com\/blog\/?p=1627"},"modified":"2014-11-30T04:41:46","modified_gmt":"2014-11-30T04:41:46","slug":"%e5%9c%a8vps%e4%b8%8a%e4%bd%bf%e7%94%a8crontab%e7%9a%84%e5%87%a0%e7%82%b9%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a1%b9","status":"publish","type":"post","link":"https:\/\/ixyzero.com\/blog\/archives\/1627.html","title":{"rendered":"\u5728VPS\u4e0a\u4f7f\u7528Crontab\u7684\u51e0\u70b9\u6ce8\u610f\u4e8b\u9879"},"content":{"rendered":"<p>\u6628\u5929\u665a\u4e0a\u5feb8\u70b9\u7684\u65f6\u5019\u8bbe\u7f6e\u4e86\u51e0\u4e2acrontab\u5b9a\u65f6\u4efb\u52a1\uff0c\u672c\u4ee5\u4e3a\u4eca\u5929\u4e0a\u73ed\u7684\u65f6\u5019\u5c31\u53ef\u4ee5\u770b\u5230\u6548\u679c\uff0c\u4f46\u662f\uff0c\u6765\u4e86\u4e4b\u540e\u53d1\u73b0\uff0c\u6839\u672c\u5c31\u6ca1\u6709\u4efb\u4f55\u5185\u5bb9o(\u256f\u25a1\u2570)o<\/p>\n<p>\u8c03\u8bd5\u4e86\u597d\u4e45\uff08ps\/lsof\uff09\u4e5f\u6ca1\u53d1\u73b0\u95ee\u9898\u6240\u5728\uff1b\u6700\u540e\u7684\u6700\u540e\uff0c\u770b\u770bdate\u547d\u4ee4\u7684\u65f6\u95f4\uff0c\u624d\u53d1\u73b0\uff1a<\/p>\n<pre class=\"lang:default decode:true\"># date\nThu Nov 27 03:51:03 EST 2014\n# date -R\nThu, 27 Nov 2014 03:52:40 -0500<\/pre>\n<p>\u672c\u5730\u7684\u65f6\u95f4\u3001\u65f6\u533a\u4e3a\uff1a<\/p>\n<pre class=\"lang:default decode:true\"># date\nThu Nov 27 17:06:13 HKT 2014\n# date -R\nThu, 27 Nov 2014 17:06:16 +0800<\/pre>\n<p>\u4e24\u8005\u4e4b\u95f4\u76f8\u9694\u4e8613\u4e2a\u5c0f\u65f6\uff0c\u6211\u52d2\u4e2a\u53bb\uff0c\u602a\u4e0d\u5f97\u5728\u7ed3\u679c\u6587\u4ef6\u5939\u4e2d\u65f6\u4e0d\u65f6\u5192\u51fa\u6765\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f46\u662f\u4f7f\u7528ps\u547d\u4ee4\u53c8\u65e0\u6cd5\u627e\u5230\u5bf9\u5e94\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\uff0c\u5f04\u5f97\u6211\u4ee5\u4e3a\u6d3b\u89c1\u9b3c\u4e86o(\u256f\u25a1\u2570)o<\/p>\n<p>\u4f7f\u7528\u56fd\u5916\u7684VPS\u4e00\u5b9a\u8981\u6ce8\u610f\u4e00\u4e0b\u65f6\u533a\u7684\u4e0d\u540c\uff0c\u514d\u5f97\u8bbe\u7f6ecrontab\u4efb\u52a1\u65f6\u51fa\u73b0\u5931\u8befo(\u256f\u25a1\u2570)o<\/p>\n<p>\u66f4\u6539Ubuntu\u4e0a\u7684\u7cfb\u7edf\u65f6\u533a\u76842\u4e2a\u65b9\u6cd5\uff08tzselect\/dpkg-reconfigure tzdata\uff09\uff1a<\/p>\n<pre class=\"lang:default decode:true\"># tz[Tab..]\ntzconfig tzselect\n\n# tzselect\nPlease identify a location so that time zone rules can be set correctly.\nPlease select a continent, ocean, \"coord\", or \"TZ\".\n1) Africa\n2) Americas\n3) Antarctica\n4) Arctic Ocean\n5) Asia\n6) Atlantic Ocean\n7) Australia\n8) Europe\n9) Indian Ocean\n10) Pacific Ocean\n11) coord - I want to use geographical coordinates.\n12) TZ - I want to specify the time zone using the Posix TZ format.\n#?\n\n# tzconfig\nWARNING: the tzconfig command is deprecated, please use:\ndpkg-reconfigure tzdata\n\n# dpkg-reconfigure tzdata #\u6253\u5f00\u4ea4\u4e92\u5f0f\u754c\u9762\u6765\u66f4\u6539\u7cfb\u7edf\u65f6\u533a<\/pre>\n<p>\u8c03\u6574\u597d\u4e86\u65f6\u533a\u4e4b\u540e\u8bb0\u5f97\u91cd\u542fcron\u670d\u52a1\uff0c\u5426\u5219\u4e0d\u4f1a\u751f\u6548\u7684\uff08Also be sure to restart cron as it won\u2019t pick up the timezone change and will still be running on UTC.\uff09\uff1a<\/p>\n<pre class=\"lang:default decode:true \">$ \/etc\/init.d\/cron stop\n$ \/etc\/init.d\/cron start<\/pre>\n<hr \/>\n<p>\u53e6\u4e00\u4e2a\u8981\u6ce8\u610f\u7684\u5730\u65b9\u5c31\u662f\uff0c\u8bb0\u5f97\u5728crontab\u4efb\u52a1\u91cc\u9762\u8bbe\u7f6elog\uff0c\u5373\uff0c\u5bf9\u6267\u884c\u7684\u4efb\u52a1\u6253\u5370\u65e5\u5fd7\uff0c\u65b9\u4fbf\u51fa\u95ee\u9898\u7684\u65f6\u5019\u8fdb\u884c\u5206\u6790\u3002\u8fd9\u91cc\u9700\u8981\u6ce8\u610f\u7684\u5c31\u662f\uff1a<\/p>\n<p><a title=\"\u91cd\u5b9a\u5411\u7684\u4e00\u4e9b\u6ce8\u610f\u4e8b\u9879{\u201c2&gt;&amp;1 &gt; file\u201d\u548c \u201c&gt; file 2&gt;&amp;1\u2033\u533a\u522b}\" href=\"http:\/\/ixyzero.com\/blog\/archives\/666.html\" target=\"_blank\">&#8220;2&gt;&amp;1 &gt; file&#8221;\u548c &#8220;&gt; file 2&gt;&amp;1&#8243;\u7684\u533a\u522b<\/a><\/p>\n<p>\u5176\u4ed6\u7684\u60f3\u5230\u4e86\u4e4b\u540e\u518d\u8865\u5145\u3002<\/p>\n<p>&nbsp;<\/p>\n<h6>\u53c2\u8003\u94fe\u63a5\uff1a<\/h6>\n<ul>\n<li><a href=\"http:\/\/www.slyar.com\/blog\/ubuntu-server-timezone.html\" target=\"_blank\">\u4fee\u6539Ubuntu Server\u65f6\u533a &#8211; Slyar Home<\/a><\/li>\n<li><a href=\"http:\/\/www.blogjava.net\/mstar\/archive\/2008\/07\/01\/ubuntu_set_time_timezone.html\" target=\"_blank\">\u8c03\u6574\u66f4\u6539ubuntu\u65f6\u533a,\u65f6\u95f4,locale &#8211; \u9ed1\u7075\u5ba2\u6808 &#8211; BlogJava<\/a><\/li>\n<li><a href=\"http:\/\/www.christopherirish.com\/2012\/03\/21\/how-to-set-the-timezone-on-ubuntu-server\/\" target=\"_blank\">How to set the timezone on Ubuntu Server<\/a><\/li>\n<li><a href=\"http:\/\/www.wikihow.com\/Change-the-Timezone-in-Linux\" target=\"_blank\">3 Ways to Change the Timezone in Linux &#8211; wikiHow<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6628\u5929\u665a\u4e0a\u5feb8\u70b9\u7684\u65f6\u5019\u8bbe\u7f6e\u4e86\u51e0\u4e2acrontab\u5b9a\u65f6\u4efb\u52a1\uff0c\u672c\u4ee5\u4e3a\u4eca\u5929\u4e0a\u73ed\u7684\u65f6\u5019\u5c31\u53ef\u4ee5\u770b\u5230\u6548\u679c\uff0c\u4f46\u662f\uff0c\u6765\u4e86\u4e4b\u540e\u53d1\u73b0\uff0c [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,11],"tags":[63,401,402,403],"class_list":["post-1627","post","type-post","status-publish","format-standard","hentry","category-knowledgebase-2","category-linux","tag-crontab","tag-timezone","tag-tzdata","tag-tzselect"],"views":4869,"_links":{"self":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/1627","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/comments?post=1627"}],"version-history":[{"count":0,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/1627\/revisions"}],"wp:attachment":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/media?parent=1627"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/categories?post=1627"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/tags?post=1627"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}