{"id":638,"date":"2015-06-30T17:56:06","date_gmt":"2015-06-30T09:56:06","guid":{"rendered":"http:\/\/www.yusian.com\/blog\/?p=638"},"modified":"2016-07-16T14:30:28","modified_gmt":"2016-07-16T06:30:28","slug":"linux%e5%a6%82%e4%bd%95%e8%ae%be%e7%bd%ae%e5%ae%9a%e6%97%b6%e4%bb%bb%e5%8a%a1","status":"publish","type":"post","link":"https:\/\/www.yusian.com\/blog\/centos\/2015\/06\/30\/175606638.html","title":{"rendered":"Linux\u5982\u4f55\u8bbe\u7f6e\u5b9a\u65f6\u4efb\u52a1"},"content":{"rendered":"<p><strong>1\u3001\u57fa\u672c\u6982\u5ff5<\/strong><\/p>\n<p>crontab\u547d\u4ee4\u5e38\u89c1\u4e8eUnix\u548c\u7c7bUnix\u7684\u64cd\u4f5c\u7cfb\u7edf\u4e4b\u4e2d\uff0c\u7528\u4e8e\u8bbe\u7f6e\u5468\u671f\u6027\u88ab\u6267\u884c\u7684\u6307\u4ee4\u3002\u8be5\u547d\u4ee4\u4ece\u6807\u51c6\u8f93\u5165\u8bbe\u5907\u8bfb\u53d6\u6307\u4ee4\uff0c\u5e76\u5c06\u5176\u5b58\u653e\u4e8e\u201ccrontab\u201d\u6587\u4ef6\u4e2d\uff0c\u4ee5\u4f9b\u4e4b\u540e\u8bfb\u53d6\u548c\u6267\u884c\u3002crontab\u50a8\u5b58\u7684\u6307\u4ee4\u88ab\u5b88\u62a4\u8fdb\u7a0b\u6fc0\u6d3b\uff0c crond\u5e38\u5e38\u5728\u540e\u53f0\u8fd0\u884c\uff0c\u6bcf\u4e00\u5206\u949f\u68c0\u67e5\u662f\u5426\u6709\u9884\u5b9a\u7684\u4f5c\u4e1a\u9700\u8981\u6267\u884c\u3002\u8fd9\u7c7b\u4f5c\u4e1a\u4e00\u822c\u79f0\u4e3acron jobs\u3002<\/p>\n<p><strong>2\u3001\u547d\u4ee4\u683c\u5f0f<\/strong><\/p>\n<pre line=\"1\"># Example of job definition:\n# .---------------- minute (0 - 59)\n# |  .------------- hour (0 - 23)\n# |  |  .---------- day of month (1 - 31)\n# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...\n# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat\n# |  |  |  |  |\n# *  *  *  *  * user-name command to be executed<\/pre>\n<p>2.1\u3001\u6bcf\u6708\u6bcf\u5929\u6bcf\u5c0f\u65f6\u7684\u7b2c 0 \u5206\u949f\u6267\u884c\u4e00\u6b21 xxoo<br \/>\n0 * * * * xxoo<\/p>\n<p>2.2\u3001\u5728 12 \u6708\u4efd\u671f\u95f4, \u6bcf\u5929\u7684\u65e9\u4e0a 6 \u70b9\u5230 12 \u70b9\u4e2d\uff0c\u6bcf\u9694 20 \u5206\u949f\u6267\u884c\u4e00\u6b21 xxoo<br \/>\n*\/20  6-12  *  12  *  xxoo<\/p>\n<p>2.3\u3001\u5468\u4e00\u5230\u5468\u4e94\u6bcf\u5929\u4e0b\u5348 5:00 xxoo<br \/>\n0 17 * * 1-5 xxoo<\/p>\n<p>2.4\u3001\u6bcf\u6708\u6bcf\u5929\u7684\u5348\u591c 0 \u70b9 20 \u5206, 2 \u70b9 20 \u5206, 4 \u70b9 20 \u5206 xxoo<br \/>\n20 0-23\/2 * * * xxoo<\/p>\n<p><strong>3\u3001\u57fa\u672c\u64cd\u4f5c<\/strong><!--more--><\/p>\n<p>crontab\u6587\u4ef6\u5305\u542b\u9001\u4ea4cron\u5b88\u62a4\u8fdb\u7a0b\u7684\u4e00\u7cfb\u5217\u4f5c\u4e1a\u548c\u6307\u4ee4\u3002\u6bcf\u4e2a\u7528\u6237\u53ef\u4ee5\u62e5\u6709\u81ea\u5df1\u7684crontab\u6587\u4ef6\uff1b\u540c\u65f6\uff0c\u64cd\u4f5c\u7cfb\u7edf\u4fdd\u5b58\u4e00\u4e2a\u9488\u5bf9\u6574\u4e2a\u7cfb\u7edf\u7684crontab\u6587\u4ef6\uff0c\u8be5\u6587\u4ef6\u901a\u5e38\u5b58\u653e\u4e8e\/etc\u6216\u8005\/etc\u4e4b\u4e0b\u7684\u5b50\u76ee\u5f55\u4e2d\uff0c\u800c\u8fd9\u4e2a\u6587\u4ef6\u53ea\u80fd\u7531\u7cfb\u7edf\u7ba1\u7406\u5458\u6765\u4fee\u6539\u3002<\/p>\n<p>3.1.1\u3001\u76f4\u63a5\u4fee\u6539etc\u4e0b\u7684crontab\u6587\u4ef6<\/p>\n<pre line=\"1\">[root@Crayfish ~]# cd \/etc\n[root@Crayfish etc]# cat crontab \nSHELL=\/bin\/bash\nPATH=\/sbin:\/bin:\/usr\/sbin:\/usr\/bin\nMAILTO=root\nHOME=\/\n\n# For details see man 4 crontabs\n\n# Example of job definition:\n# .---------------- minute (0 - 59)\n# |  .------------- hour (0 - 23)\n# |  |  .---------- day of month (1 - 31)\n# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...\n# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat\n# |  |  |  |  |\n# *  *  *  *  * user-name command to be executed\n[root@Crayfish etc]# vi crontab<\/pre>\n<p>3.1.2\u3001\u901a\u8fc7crontab\u547d\u4ee4<br \/>\n[root@Crayfish etc]# crontab -e<\/p>\n<p>3.2\u3001\u52a0\u5165\u4efb\u52a1\u961f\u5217<br \/>\n[root@Crayfish etc]# crontab crontab<\/p>\n<p><strong>4\u3001\u4efb\u52a1\u7ba1\u7406<\/strong><\/p>\n<p>4.1\u3001\u4efb\u52a1\u67e5\u770b<br \/>\n[root@Crayfish etc]# crontab -l<br \/>\n4.2\u3001\u4efb\u52a1\u5220\u9664<br \/>\n[root@Crayfish etc]# crontab -r<br \/>\n4.3\u3001\u4efb\u52a1\u7f16\u8f91<br \/>\n[root@Crayfish etc]# crontab -e<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u57fa\u672c\u6982\u5ff5 crontab\u547d\u4ee4\u5e38\u89c1\u4e8eUnix\u548c\u7c7bUnix\u7684\u64cd\u4f5c\u7cfb\u7edf\u4e4b\u4e2d\uff0c\u7528\u4e8e\u8bbe\u7f6e\u5468\u671f\u6027\u88ab\u6267\u884c\u7684\u6307\u4ee4\u3002\u8be5\u547d\u4ee4\u4ece\u6807\u51c6\u8f93\u5165\u8bbe\u5907\u8bfb\u53d6\u6307\u4ee4\uff0c\u5e76\u5c06\u5176\u5b58\u653e\u4e8e\u201ccrontab\u201d\u6587\u4ef6\u4e2d\uff0c\u4ee5\u4f9b\u4e4b\u540e\u8bfb\u53d6\u548c\u6267\u884c\u3002crontab\u50a8\u5b58\u7684\u6307\u4ee4\u88ab\u5b88\u62a4\u8fdb\u7a0b\u6fc0\u6d3b\uff0c crond\u5e38\u5e38\u5728\u540e\u53f0\u8fd0\u884c\uff0c\u6bcf\u4e00\u5206\u949f\u68c0\u67e5\u662f\u5426\u6709\u9884\u5b9a\u7684\u4f5c\u4e1a\u9700\u8981\u6267\u884c\u3002\u8fd9\u7c7b\u4f5c\u4e1a\u4e00\u822c\u79f0\u4e3acron jobs\u3002 2\u3001\u547d\u4ee4\u683c\u5f0f # Example of job definition: # .&#8212;&#8212;&#8212;&#8212;&#8212;- minute (0 &#8211; 59) # | .&#8212;&#8212;&#8212;&#8212;- hour (0 &#8211; 23) # | | .&#8212;&#8212;&#8212;- day of month (1 &#8211; 31) # | | | .&#8212;&#8212;- month (1 &#8211; 12) OR jan,feb,mar,apr &#8230; # | | | | .&#8212;- day of week (0 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[8],"class_list":["post-638","post","type-post","status-publish","format-standard","hentry","category-centos","tag-linux"],"_links":{"self":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/638","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/comments?post=638"}],"version-history":[{"count":0,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/638\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/media?parent=638"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/categories?post=638"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/tags?post=638"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}