{"id":1818,"date":"2017-06-17T08:34:24","date_gmt":"2017-06-17T00:34:24","guid":{"rendered":"http:\/\/1vr.cn\/?p=1818"},"modified":"2021-05-26T16:37:13","modified_gmt":"2021-05-26T08:37:13","slug":"centos%e4%b8%8b%e7%94%a8crontab%e8%ae%be%e7%bd%ae%e8%87%aa%e5%8a%a8%e9%87%8d%e5%90%afmysql%e8%ae%a1%e5%88%92","status":"publish","type":"post","link":"https:\/\/1vr.cn\/?p=1818","title":{"rendered":"CentOS\u4e0b\u7528crontab\u8bbe\u7f6e\u81ea\u52a8\u91cd\u542fMySQL\u8ba1\u5212"},"content":{"rendered":"<p>\u535a\u5ba2\u603b\u6709\u673a\u5668\u4eba\u53d1\u5783\u573e\u8bc4\u8bba,\u7528\u4e86\u4e00\u79cd\u9a8c\u8bc1\u7801\u63d2\u4ef6,\u4e0d\u7075,\u4eca\u5929\u6362\u6210\u4e86CaptchaBank\u7684\u63d2\u4ef6,\u4e0d\u77e5\u9053\u5b9e\u9645\u6548\u679c\u5982\u4f55,\u6d4b\u8bd5\u51e0\u5929\u770b\u770b\u7ed3\u679c,\u5e2e\u4ed6\u4eec\u505a\u4e86\u4e0b\u672c\u5730\u5316\u7ffb\u8bd1,\u7528wordpress\u7684\u518d\u7528\u8fd9\u4e2a\u63d2\u4ef6\u5c31\u6709\u4e2d\u6587\u7248\u7528\u5566.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1823\" src=\"http:\/\/1vr.cn\/wp-content\/uploads\/2017\/06\/CBA0F328-20E1-4F96-9B9B-B23EF43A7F83.jpg\" alt=\"\" width=\"1000\" height=\"470\" srcset=\"\/wp-content\/uploads\/2017\/06\/CBA0F328-20E1-4F96-9B9B-B23EF43A7F83.jpg 1000w, \/wp-content\/uploads\/2017\/06\/CBA0F328-20E1-4F96-9B9B-B23EF43A7F83-300x141.jpg 300w, \/wp-content\/uploads\/2017\/06\/CBA0F328-20E1-4F96-9B9B-B23EF43A7F83-768x361.jpg 768w, \/wp-content\/uploads\/2017\/06\/CBA0F328-20E1-4F96-9B9B-B23EF43A7F83-720x338.jpg 720w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/p>\n<p>\u670d\u52a1\u5668\u4e0a\u7528\u7684MySQL\u603b\u81ea\u52a8\u505c\u6b62\u5de5\u4f5c,\u6ca1\u67e5\u5230\u539f\u56e0,\u5e72\u8106\u5efa\u4e2a\u8ba1\u5212\u8ba9\u5b83\u81ea\u5df1\u91cd\u751f.<br \/>\n\u662fCentOS\u7cfb\u7edf,\u6ca1\u6709crontab\u8fd9\u4e2a\u8ba1\u5212\u4efb\u52a1\u670d\u52a1,\u5728\u7cfb\u7edf\u547d\u4ee4\u884c\u4e0a\u4f7f\u7528\u4e0b\u9762\u8fd9\u4e24\u6761\u547d\u4ee4\u5b89\u88c5crontabs,\u7b2c\u4e00\u4e2avixie-cron\u4e3b\u7a0b\u5e8f\u5305,\u5b89\u88c5\u5b83\u540e,\u7cfb\u7edf\u4e00\u822c\u4f1a\u81ea\u52a8\u5e2e\u4f60\u88c5\u597dcrontabs\u8f6f\u4ef6\u5305,\u5373\u7b2c\u4e8c\u6761\u547d\u4ee4\u53ef\u4ee5\u5ffd\u7565,\u5177\u4f53\u770b\u662f\u5426\u5b89\u88c5\u6210\u529f\u518d\u5b9a.<br \/>\n<!--more--><br \/>\n\u542f\u52a8,\u505c\u6b62crontabs\u670d\u52a1\u548c\u5176\u5b83\u670d\u52a1\u63a7\u5236\u4e00\u6837:<\/p>\n<pre>service crond start \/\/\u542f\u52a8\u670d\u52a1\nservice crond stop \/\/\u5173\u95ed\u670d\u52a1\nservice crond restart \/\/\u91cd\u542f\u670d\u52a1\nservice crond reload \/\/\u91cd\u65b0\u8f7d\u5165\u914d\u7f6e\nservice crond status  \/\/\u67e5\u770bcrond\u542f\u52a8\u72b6\u6001<\/pre>\n<p>\u7528ntsysv\u547d\u4ee4\u67e5\u770b\u81ea\u542f\u52a8\u7684\u670d\u52a1,\u5982\u679ccrontab\u6ca1\u6709\u81ea\u542f\u52a8,\u4f7f\u7528\u4e0b\u9762\u547d\u4ee4\u8ba9\u5b83\u81ea\u542f\u52a8:<\/p>\n<pre>chkconfig \u2013level 35 crond on<\/pre>\n<p>\u914d\u7f6ecrond\u670d\u52a1\u542f\u52a8\u8ba1\u5212\u9700\u8981\u7f16\u8f91etc\u76ee\u5f55\u4e0b\u7684crontab\u6587\u4ef6\u5185\u5bb9,\u76f4\u63a5\u7528Vim\u7f16\u8f91\u5b83:<\/p>\n<pre>vim \/etc\/crontab<\/pre>\n<p>\u770b\u5230\u9ed8\u8ba4\u91cc\u9762\u6709\u8fd9\u4e9b\u6ce8\u91ca,\u8bf4\u660e\u4e86\u7528\u6cd5,\u65e0\u5916\u4e4e\u5c31\u662f\u8ba1\u5212\u7684\u6267\u884c\u65f6\u95f4\u5468\u671f.<\/p>\n<pre>SHELL=\/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,w    ed,thu,fri,sat\n # |  |  |  |  |\n # *  *  *  *  * user-name command to be executed<\/pre>\n<p>vim\u7f16\u8f91\u547d\u4ee4\u4e0d\u719f\u7684\u53ef\u4ee5\u641c\u7d22\u4e00\u4e0b,\u4e0d\u96be,\u6dfb\u52a0\u4e00\u884c,\u6bd4\u5982\u6211\u8981\u6bcf\u5929\u51cc\u66682:30\u81ea\u52a8\u91cd\u542f\u4e00\u6b21mysql\u5c31\u6dfb\u52a0\u4e0b\u9762\u8fd9\u6837\u4e00\u884c:<\/p>\n<pre>30 2 * * * root service mysqld restart<\/pre>\n<p>\u4fdd\u5b58\u91cd\u542f\u4e0bcrontabs\u5c31\u53ef\u4ee5\u4e86.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u535a\u5ba2\u603b\u6709\u673a\u5668\u4eba\u53d1\u5783\u573e\u8bc4\u8bba,\u7528\u4e86\u4e00\u79cd\u9a8c\u8bc1\u7801\u63d2\u4ef6,\u4e0d\u7075,\u4eca\u5929\u6362\u6210\u4e86CaptchaBank\u7684\u63d2\u4ef6,\u4e0d\u77e5\u9053\u5b9e\u9645\u6548\u679c\u5982\u4f55 &hellip; <a href=\"https:\/\/1vr.cn\/?p=1818\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">CentOS\u4e0b\u7528crontab\u8bbe\u7f6e\u81ea\u52a8\u91cd\u542fMySQL\u8ba1\u5212<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-1818","post","type-post","status-publish","format-standard","hentry","category-10","without-featured-image"],"_links":{"self":[{"href":"https:\/\/1vr.cn\/index.php?rest_route=\/wp\/v2\/posts\/1818","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/1vr.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/1vr.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/1vr.cn\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/1vr.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1818"}],"version-history":[{"count":3,"href":"https:\/\/1vr.cn\/index.php?rest_route=\/wp\/v2\/posts\/1818\/revisions"}],"predecessor-version":[{"id":2434,"href":"https:\/\/1vr.cn\/index.php?rest_route=\/wp\/v2\/posts\/1818\/revisions\/2434"}],"wp:attachment":[{"href":"https:\/\/1vr.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1818"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/1vr.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1818"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/1vr.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1818"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}