linux \u67e5\u770bcrontab\u662f\u5426\u8fd0\u884c<\/strong>\uff0c\u6267\u884c\u201ccrontab -e\u201d\u547d\u4ee4\u5373\u53ef\u3002\u63a5\u7740\uff0c\u5728\u6587\u4ef6\u5185\u6dfb\u52a0\u4e00\u4e2a\u6613\u4e8e\u9a8c\u8bc1\u7684\u4efb\u52a1\uff0c\u6bd4\u5982\u201c <\/b> <\/b> * echo 'test crontab' > \/tmp\/test.txt\u201d\u3002\u8fd9\u884c\u6307\u4ee4\u7684\u610f\u601d\u662f\uff0c\u6bcf\u5206\u949f\u90fd\u4f1a\u628a\u201ctest crontab\u201d\u8fd9\u51e0\u4e2a\u5b57\u5199\u5165\u5230\/tmp\u76ee\u5f55\u4e0b\u7684test.txt\u6587\u4ef6\u91cc\u3002<\/p>\n<\/p>\n
\u8fc7\u4e86\u4e00\u6bb5\u65f6\u95f4\uff0c\u5148\u770b\u770b\/tmp\/test.txt\u6587\u4ef6\u662f\u5426\u5b58\u5728\uff0c\u518d\u68c0\u67e5\u91cc\u9762\u7684\u5185\u5bb9\u662f\u5426\u7b26\u5408\u8981\u6c42\u3002\u5982\u679c\u6587\u4ef6\u5b58\u5728\u4e14\u5185\u5bb9\u662f\u5bf9\u7684\uff0c\u90a3crontab\u5e94\u8be5\u80fd\u6b63\u5e38\u8fd0\u884c\u3002\u4f46\u5982\u679c\u6d4b\u8bd5\u6ca1\u901a\u8fc7\uff0c\u95ee\u9898\u53ef\u80fd\u4e0d\u5728crontab\u672c\u8eab\uff0c\u800c\u662f\u6743\u9650\u6216\u5176\u4ed6\u56e0\u7d20\u5e72\u6270\u4e86\u4efb\u52a1\u7684\u6267\u884c\u3002\u56e0\u6b64\uff0c\u8fd8\u9700\u6df1\u5165\u8c03\u67e5\uff0c\u6bd4\u5982\u67e5\u770b\/tmp\u76ee\u5f55\u7684\u6743\u9650\u8bbe\u7f6e\u7b49\u3002<\/p>\n
\u68c0\u67e5crontab\u670d\u52a1\u72b6\u6001<\/b><\/p>\n
\u4e0d\u540c\u7684Linux\u7248\u672c\u5728\u7ba1\u7406crontab\u670d\u52a1\u4e0a\u53ef\u80fd\u5b58\u5728\u5dee\u5f02\u3002\u6bd4\u5982\uff0c\u5728\u91c7\u7528systemd\u7684\u7cfb\u7edf\u4e0a\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u201csystemctl status crond.service\u201d\u6765\u67e5\u770b\u670d\u52a1\u72b6\u6001\u3002\u82e5\u72b6\u6001\u663e\u793a\u4e3a\u201cactive (running)\u201d\uff0c\u5219\u8bf4\u660e\u670d\u52a1\u6b63\u5728\u8fd0\u884c\uff1b\u82e5\u663e\u793a\u4e3a\u201cinactive (dead)\u201d\u7b49\uff0c\u5219\u8868\u793a\u670d\u52a1\u672a\u542f\u52a8\u3002<\/p>\n
\u540c\u65f6\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u6267\u884c\u670d\u52a1\u7ba1\u7406\u6307\u4ee4\u6765\u5c1d\u8bd5\u5f00\u542f\u6216\u91cd\u65b0\u542f\u52a8crontab\uff0c\u4ee5\u89e3\u51b3\u8fd0\u884c\u4e2d\u7684\u95ee\u9898\u3002\u6bd4\u5982\uff0c\u5f53\u53d1\u73b0\u670d\u52a1\u5df2\u505c\u6b62\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528\u201csystemctl start crond.service\u201d\u6765\u542f\u52a8\u5b83\u3002\u4f46\u5728\u8fdb\u884c\u8fd9\u4e00\u64cd\u4f5c\u4e4b\u524d\uff0c\u5148\u68c0\u67e5\u4f9d\u8d56\u9879\u6216\u914d\u7f6e\u6587\u4ef6\u662f\u5426\u65e0\u8bef\uff0c\u4ee5\u9632\u542f\u52a8\u4e0d\u6210\u529f\u3002<\/p>\n
\u67e5\u770b\u7cfb\u7edf\u8d44\u6e90\u5360\u7528<\/b><\/p>\n
<\/p>\n
\u5c3d\u7ba1\u8fd9\u5e76\u975e\u76f4\u63a5\u7684\u8bc4\u4f30\u624b\u6bb5\uff0c\u5374\u80fd\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u95f4\u63a5\u663e\u793a\u51facrontab\u7684\u8fd0\u884c\u72b6\u6001\u3002\u82e5crontab\u5904\u4e8e\u6b63\u5e38\u5de5\u4f5c\u72b6\u6001\uff0c\u5b83\u5c06\u6d88\u8017\u90e8\u5206\u7cfb\u7edf\u8d44\u6e90\uff0c\u6bd4\u5982CPU\u548c\u5185\u5b58\u3002\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u201ctop\u201d\u6216\u201chtop\u201d\u7b49\u5de5\u5177\u6765\u76d1\u63a7\u8d44\u6e90\u4f7f\u7528\u60c5\u51b5\u3002\u5728\u8fd9\u4e9b\u5de5\u5177\u7684\u754c\u9762\u4e2d\uff0c\u53ef\u4ee5\u627e\u5230\u4e0e\u201ccron\u201d\u6216\u76f8\u5173\u4efb\u52a1\u540d\u79f0\u5bf9\u5e94\u7684\u8fdb\u7a0b\u3002<\/p>\n
\u82e5\u672a\u89c2\u5bdf\u5230\u8fd9\u4e00\u8fdb\u5c55\uff0c\u4e14crontab\u6240\u6267\u884c\u7684\u4efb\u52a1\u5e76\u672a\u5728\u7cfb\u7edf\u8d44\u6e90\u6e05\u5355\u4e2d\u53cd\u6620\u8d44\u6e90\u6d88\u8017\uff0c\u8fd9\u6216\u8bb8\u8868\u660ecrontab\u672a\u542f\u52a8\u6216\u542f\u52a8\u5f02\u5e38\u3002\u53e6\u5916\uff0c\u82e5\u53d1\u73b0\u67d0\u4e2a\u4e0ecrontab\u76f8\u5173\u7684\u8fdb\u7a0b\u8d44\u6e90\u4f7f\u7528\u5f02\u5e38\u9ad8\uff0c\u8fd9\u53ef\u80fd\u662f\u4efb\u52a1\u51fa\u73b0\u6545\u969c\u6216\u9677\u5165\u65e0\u9650\u5faa\u73af\u7b49\u5f02\u5e38\u72b6\u6001\uff0c\u540c\u6837\u9700\u8981\u6df1\u5165\u8c03\u67e5\u3002<\/p>\n
\u786e\u8ba4\u914d\u7f6e\u6587\u4ef6\u7684\u6b63\u786e\u6027<\/b><\/p>\n
<\/p>\n
\u786e\u4fdd\u914d\u7f6e\u6587\u4ef6\u65e0\u8bef\u5bf9crontab\u7684\u6b63\u5e38\u8fd0\u4f5c\u6781\u4e3a\u5173\u952e\u3002crontab\u7684\u914d\u7f6e\u6587\u4ef6\u53ef\u80fd\u4f4d\u4e8e\u4e0d\u540c\u7cfb\u7edf\u7684\u4e0d\u540c\u4f4d\u7f6e\uff0c\u4f46\u901a\u5e38\u5728\u201c\/etc\/crontab\u201d\u6216\u201c\/etc\/cron.d\u201d\u76ee\u5f55\u4e2d\u3002\u9700\u68c0\u67e5\u6587\u4ef6\u662f\u5426\u5b58\u5728\u8bed\u6cd5\u9519\u8bef\uff0c\u8def\u5f84\u8bbe\u7f6e\u662f\u5426\u6070\u5f53\u3002<\/p>\n
\u5728\u6267\u884c\u4efb\u52a1\u65f6\uff0c\u82e5\u9700\u8fd0\u884c\u811a\u672c\uff0c\u811a\u672c\u8def\u5f84\u5fc5\u987b\u7cbe\u786e\u65e0\u8bef\u3002\u8def\u5f84\u51fa\u9519\u53ef\u80fd\u4f7f\u4efb\u52a1\u65e0\u6cd5\u8fd0\u884c\u3002\u7f16\u8f91\u5b8c\u914d\u7f6e\u6587\u4ef6\u540e\uff0c\u53ef\u7528\u201ccrontab -l\u201d\u67e5\u770b\u5f53\u524d\u4efb\u52a1\u8bbe\u7f6elinux \u5b89\u88c5\uff0c\u68c0\u67e5\u662f\u5426\u5b58\u5728\u95ee\u9898\u3002\u82e5\u914d\u7f6e\u6587\u4ef6\u9519\u8bef\u4f17\u591a\u6216\u590d\u6742\uff0c\u96be\u4ee5\u6392\u67e5\uff0c\u53ef\u5148\u5907\u4efd\u73b0\u6709\u6587\u4ef6\uff0c\u518d\u91cd\u65b0\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684\u4efb\u52a1\u914d\u7f6e\u6587\u4ef6\uff0c\u4ee5\u6d4b\u8bd5crontab\u80fd\u5426\u6b63\u5e38\u8fd0\u4f5c\u3002<\/p>\n
\u8fd9\u7bc7\u6587\u7ae0\u6216\u8bb8\u80fd\u5e2e\u52a9\u5927\u5bb6\u4e86\u89e3\u5982\u4f55\u5728Linux\u4e2d\u68c0\u67e5crontab\u662f\u5426\u5728\u8fd0\u884c\u3002\u5927\u5bb6\u5728\u67e5\u770bcrontab\u7684\u8fd0\u884c\u72b6\u6001\u65f6\uff0c\u662f\u5426\u9047\u5230\u8fc7\u5176\u4ed6\u96be\u9898\uff1f\u5982\u679c\u6709\u7684\u8bdd\uff0c\u4e0d\u59a8\u5728\u8bc4\u8bba\u533a\u544a\u8bc9\u6211\u4eec\u3002\u540c\u65f6\uff0c\u4e5f\u6b22\u8fce\u70b9\u8d5e\u548c\u8f6c\u53d1\u8fd9\u7bc7\u6587\u7ae0\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
\u638c\u63e1\u67e5\u770bcrontab\u8fd0\u884c\u72b6\u6001\u7684\u65b9\u6cd5\uff0c\u80fd\u8ba9\u6211\u4eec\u66f4\u9ad8\u6548\u5730\u7ba1\u7406\u5b9a\u65f6\u4efb\u52a1\uff0c\u9632\u6b62\u56e0\u4efb\u52a1\u672a\u6267\u884c\u800c\u4ea7\u751f\u95ee\u9898\u3002\u8981\u68c0\u67e5crontab\u8fdb\u7a0b\u662f\u5426\u5728\u8fd0\u884c\uff0c\u67e5\u770b\u5176\u5bf9\u5e94\u8fdb\u7a0b\u662f\u4e2a\u76f4\u63a5\u7684\u65b9\u6cd5\u3002\u786e\u4fdd\u914d\u7f6e\u6587\u4ef6\u65e0\u8bef\u5bf9crontab\u7684\u6b63\u5e38\u8fd0\u4f5c\u6781\u4e3a\u5173\u952e\u3002\u5728\u6267\u884c\u4efb\u52a1\u65f6\uff0c\u82e5\u9700\u8fd0\u884c\u811a\u672c\uff0c\u811a\u672c\u8def\u5f84\u5fc5\u987b\u7cbe\u786e\u65e0\u8bef\u3002<\/p>\n","protected":false},"author":1,"featured_media":295049,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[112,5005,3925,5004,5006],"class_list":["post-295048","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-crontab","tag-dsrwgl","tag-fwgl","tag-yxzt","tag-jcjc"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/295048","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=295048"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/295048\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/295049"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=295048"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=295048"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=295048"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}