{"id":244556,"date":"2022-06-21T09:27:18","date_gmt":"2022-06-21T01:27:18","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=244556"},"modified":"2022-06-04T22:28:52","modified_gmt":"2022-06-04T14:28:52","slug":"manage-crontab-tool","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/manage-crontab-tool.html","title":{"rendered":"\u7ba1\u7406 crontab \u7684\u5f00\u6e90\u5de5\u5177"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\ncrontab-ui \u662f\u4e00\u4e2a\u7528 Node.js \u7f16\u5199\u7684 Web \u524d\u7aef\uff0c\u5e2e\u52a9\u7ba1\u7406 crontab \u6587\u4ef6\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u81ea\u52a8\u5316\u662f\u76ee\u524d\u7684\u4e00\u4e2a\u70ed\u95e8\u8bdd\u9898\u3002\u5728\u6211\u4f5c\u4e3a\u7f51\u7ad9\u53ef\u9760\u6027\u5de5\u7a0b\u5e08\uff08SRE\uff09\u7684\u65e5\u5e38\u5de5\u4f5c\u4e2d\uff0c\u6211\u7684\u90e8\u5206\u804c\u8d23\u662f\u5c06\u5c3d\u53ef\u80fd\u591a\u7684\u91cd\u590d\u6027\u4efb\u52a1\u81ea\u52a8\u5316\u3002\u4f46\u662f\uff0c\u6709\u591a\u5c11\u4eba\u5728\u6211\u4eec\u7684\u65e5\u5e38\u975e\u5de5\u4f5c\u751f\u6d3b\u4e2d\u8fd9\u6837\u505a\u5462\uff1f\u4eca\u5e74\uff0c\u6211\u4e13\u6ce8\u4e8e\u5c06\u52b3\u4f5c\u81ea\u52a8\u5316\uff0c\u4ee5\u4fbf\u6211\u4eec\u53ef\u4ee5\u4e13\u6ce8\u4e8e\u91cd\u8981\u7684\u4e8b\u60c5\u3002<\/em><\/p>\n

\u4f5c\u4e3a\u4e00\u4e2a\u521d\u51fa\u8305\u5e90\u7684\u7cfb\u7edf\u7ba1\u7406\u5458\uff0c\u6211\u6700\u65e9\u4e86\u89e3\u7684\u4e1c\u897f\u4e4b\u4e00\u662f \u201ccron\u201d\u3002cron \u88ab\u5e7f\u6cdb\u7528\u4e8e\u505a\u4e00\u4e9b\u4e8b\u60c5\uff0c\u5982\u8f6e\u6362\u65e5\u5fd7\u3001\u542f\u52a8\u548c\u505c\u6b62\u670d\u52a1\u3001\u8fd0\u884c\u7a0b\u5e8f\u4f5c\u4e1a\u7b49\u7b49\u3002\u5b83\u5728\u51e0\u4e4e\u6240\u6709\u7684 Unix \u548c Linux \u7cfb\u7edf\u4e2d\u90fd\u53ef\u7528\uff0c\u800c\u4e14\u662f\u6211\u8ba4\u8bc6\u7684\u6bcf\u4e2a\u7cfb\u7edf\u7ba1\u7406\u5458\u7528\u6765\u5e2e\u52a9\u7ba1\u7406\u670d\u52a1\u548c\u670d\u52a1\u5668\u7684\u4e1c\u897f\u3002cron \u53ef\u4ee5\u81ea\u52a8\u8fd0\u884c\u4efb\u4f55\u63a7\u5236\u53f0\u5e94\u7528\u6216\u811a\u672c\uff0c\u8fd9\u4f7f\u5f97\u5b83\u975e\u5e38\u3001\u975e\u5e38\u7075\u6d3b\u3002<\/p>\n

LCTT \u8bd1\u6ce8\uff1aCRON \u662f \u201cCommand Run On\u201d \u7684\u7f29\u5199\uff0c\u5373\u5728\u67d0\u4e2a\u65f6\u95f4\u8fd0\u884c\u547d\u4ee4\u3002<\/p><\/blockquote>\n

\"\"<\/p>\n

Image of a Crontab<\/em><\/p>\n

\u6211\u7528 cron \u6765\u83b7\u53d6\u7535\u5b50\u90ae\u4ef6\uff0c\u8fd0\u884c\u8fc7\u6ee4\u7a0b\u5e8f\uff0c\u786e\u4fdd\u670d\u52a1\u6b63\u5728\u8fd0\u884c\uff0c\u4e0e Habitica \u7b49\u5728\u7ebf\u6e38\u620f\u4e92\u52a8\u7b49\u3002<\/p>\n

\u4ee5\u4f20\u7edf\u65b9\u5f0f\u4f7f\u7528 cron<\/strong><\/div>\n

\u8981\u5f00\u59cb\u4f7f\u7528 cron\uff0c\u4f60\u53ef\u4ee5\u7b80\u5355\u5730\u5728\u547d\u4ee4\u884c\u8f93\u5165\u00a0crontab -e<\/code>\uff0c\u542f\u52a8\u4e00\u4e2a\u6253\u5f00\u4e86\u5f53\u524d\u00a0crontab<\/code>\uff08\u201ccron table\u201d \u7684\u7f29\u5199\uff09\u6587\u4ef6\u7684\u7f16\u8f91\u5668\uff08\u5982\u679c\u4f60\u4ee5 root \u8eab\u4efd\u8fd9\u6837\u505a\uff0c\u4f60\u8bbf\u95ee\u7684\u662f\u7cfb\u7edf crontab\uff09\u3002\u8fd9\u662f\u4fdd\u5b58\u4f5c\u4e1a\u8ba1\u5212\u7684\u5730\u65b9\uff0c\u8bb0\u5f55\u4e86\u4f55\u65f6\u8fd0\u884c\u3002David Both \u5df2\u7ecf\u5199\u4e86\u00a0\u5927\u91cf<\/a>[1]<\/span>\u00a0\u5173\u4e8e\u8be5\u6587\u4ef6\u7684\u683c\u5f0f\u548c\u5982\u4f55\u4f7f\u7528\u5b83\u7684\u6587\u7ae0\uff0c\u6240\u4ee5\u6211\u4e0d\u6253\u7b97\u5728\u8fd9\u91cc\u4ecb\u7ecd\u3002\u6211\u8981\u8bf4\u7684\u662f\uff0c\u5bf9\u4e8e\u65b0\u7528\u6237\u6765\u8bf4\uff0c\u8fd9\u53ef\u80fd\u6709\u70b9\u5413\u4eba\uff0c\u800c\u4e14\u8bbe\u7f6e\u65f6\u95f4\u6709\u70b9\u75db\u82e6\u3002<\/p>\n

\u4ecb\u7ecd crontab-ui<\/strong><\/div>\n

\u6709\u4e00\u4e9b\u5947\u5999\u7684\u5de5\u5177\u53ef\u4ee5\u5e2e\u52a9\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002\u6211\u6700\u559c\u6b22\u7684\u662f\u00a0crontab-ui<\/a>[2]<\/span>\uff0c\u8fd9\u662f\u4e00\u4e2a\u7528 Node.js \u7f16\u5199\u7684 Web \u524d\u7aef\uff0c\u53ef\u4ee5\u5e2e\u52a9\u7ba1\u7406 crontab \u6587\u4ef6\u3002\u4e3a\u4e86\u5b89\u88c5\u548c\u542f\u52a8\u00a0crontab-ui<\/code>\u00a0\u4f9b\u4e2a\u4eba\u4f7f\u7528\uff0c\u6211\u4f7f\u7528\u4e86\u4ee5\u4e0b\u547d\u4ee4\u3002<\/p>\n

# \u505a\u4e2a\u5907\u4efd\r\ncrontab -l > $HOME\/crontab-backup\r\n# \u5b89\u88c5 Crontab UI\r\nnpm install -g crontab-ui\r\n# \u521b\u5efa\u672c\u5730\u6570\u636e\u5e93\u76ee\u5f55\r\nmkdir $HOME\/crontab-ui\r\n# \u542f\u52a8 crontab-ui\r\nCRON_DB_PATH=$HOME\/crontab-ui crontab-ui\r\n<\/code><\/pre>\n

\u5b8c\u6210\u8fd9\u4e9b\u540e\uff0c\u53ea\u9700\u5c06\u4f60\u7684\u7f51\u9875\u6d4f\u89c8\u5668\u6307\u5411\u00a0http:\/\/localhost:8000<\/code>\uff0c\u4f60\u5c31\u4f1a\u770b\u5230 crontab-ui \u7684\u7f51\u9875\u754c\u9762\u3002\u8981\u505a\u7684\u7b2c\u4e00\u4ef6\u4e8b\u662f\u70b9\u51fb \u201c\u4ece Crontab \u83b7\u53d6Get from Crontab<\/rt><\/ruby>\u201d\uff0c\u52a0\u8f7d\u4f60\u53ef\u80fd\u6709\u7684\u4efb\u4f55\u73b0\u6709\u4f5c\u4e1a\u3002\u7136\u540e\u70b9\u51fb\u201c\u5907\u4efdBackup<\/rt><\/ruby>\u201d\uff0c\u8fd9\u6837\u4f60\u5c31\u53ef\u4ee5\u56de\u6eda\u4f60\u6240\u505a\u7684\u4efb\u4f55\u4fee\u6539\u3002<\/p>\n

\"\"<\/p>\n

Image of Crontab-UI<\/em><\/p>\n

\u6dfb\u52a0\u548c\u7f16\u8f91 cron \u4f5c\u4e1a\u662f\u975e\u5e38\u7b80\u5355\u7684\u3002\u6dfb\u52a0\u4e00\u4e2a\u540d\u79f0\uff0c\u4f60\u60f3\u8fd0\u884c\u7684\u5b8c\u6574\u547d\u4ee4\uff0c\u4ee5\u53ca\u65f6\u95f4\uff08\u4f7f\u7528 cron \u8bed\u6cd5\uff09\uff0c\u7136\u540e\u4fdd\u5b58\u3002\u53e6\u5916\uff0c\u4f60\u8fd8\u53ef\u4ee5\u6355\u83b7\u65e5\u5fd7\uff0c\u5e76\u8bbe\u7f6e\u5c06\u5de5\u4f5c\u72b6\u6001\u90ae\u5bc4\u5230\u4f60\u9009\u62e9\u7684\u7535\u5b50\u90ae\u7bb1\u3002<\/p>\n

\u5b8c\u6210\u540e\uff0c\u70b9\u51fb \u201c\u4fdd\u5b58\u5230 CrontabSave to Crontab<\/rt><\/ruby>\u201d\u3002<\/p>\n

\u6211\u4e2a\u4eba\u975e\u5e38\u559c\u6b22\u5b83\u7684\u65e5\u5fd7\u8bb0\u5f55\u529f\u80fd\u3002\u6709\u4e86 crontab-ui\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u70b9\u51fb\u4e00\u4e2a\u6309\u94ae\u6765\u67e5\u770b\u65e5\u5fd7\uff0c\u8fd9\u5728\u6392\u9664\u6545\u969c\u65f6\u975e\u5e38\u6709\u7528\u3002<\/p>\n

\u6211\u5efa\u8bae\u4e0d\u8981\u4e00\u76f4\u8fd0\u884c crontab-ui\uff0c\u81f3\u5c11\u4e0d\u8981\u516c\u5f00\u8fd0\u884c\u3002\u867d\u7136\u5b83\u786e\u5b9e\u5177\u6709\u4e00\u4e9b\u57fa\u672c\u7684\u8eab\u4efd\u9a8c\u8bc1\u529f\u80fd\uff0c\u4f46\u5b83\u4e0d\u5e94\u8be5\u66b4\u9732\u5728\u4f60\u7684\u672c\u5730\u673a\u5668\u4e4b\u5916\u3002\u6211\u4e0d\u9700\u8981\u7ecf\u5e38\u7f16\u8f91\u6211\u7684 cron \u4f5c\u4e1a\uff0c\u6240\u4ee5\u6211\u53ef\u4ee5\u6309\u9700\u542f\u52a8\u548c\u505c\u6b62\u5b83\u3002<\/p>\n

\u4e0b\u6b21\u4f60\u9700\u8981\u7f16\u8f91\u4f60\u7684 crontab \u65f6\uff0c\u53ef\u4ee5\u8bd5\u8bd5 crontab-ui\uff01<\/p>\n

\uff08\u9898\u56fe\u7531\u00a0FelixMittermeier<\/a>[3]<\/span>\u00a0\u5728\u00a0Pixabay<\/a>[4]<\/span>\u00a0\u4e0a\u53d1\u5e03\uff09<\/p>\n


\n

via:\u00a0https:\/\/opensource.com\/article\/22\/5\/cron-crontab-ui<\/a><\/p>\n

\u4f5c\u8005\uff1aKevin Sonney<\/a>[5]<\/span>\u00a0\u9009\u9898\uff1alkxed<\/a>[6]<\/span>\u00a0\u8bd1\u8005\uff1ageekpi<\/a>[7]<\/span>\u00a0\u6821\u5bf9\uff1awxy<\/a>[8]<\/span><\/p>\n

\u672c\u6587\u7531\u00a0LCTT<\/a>[9]<\/span>\u00a0\u539f\u521b\u7f16\u8bd1\uff0cLinux\u4e2d\u56fd<\/a>[10]<\/span>\u00a0\u8363\u8a89\u63a8\u51fa<\/p>\n","protected":false},"excerpt":{"rendered":"

\u81ea\u52a8\u5316\u662f\u76ee\u524d\u7684\u4e00\u4e2a\u70ed\u95e8\u8bdd\u9898\u3002\u5728\u6211\u4f5c\u4e3a\u7f51\u7ad9\u53ef\u9760\u6027\u5de5\u7a0b\u5e08\uff08SRE\uff09\u7684\u65e5\u5e38\u5de5\u4f5c\u4e2d\uff0c\u6211\u7684\u90e8\u5206\u804c\u8d23\u662f\u5c06\u5c3d\u53ef\u80fd\u591a\u7684\u91cd\u590d\u6027\u4efb […]<\/p>\n","protected":false},"author":309,"featured_media":244618,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-244556","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/244556","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\/309"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=244556"}],"version-history":[{"count":5,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/244556\/revisions"}],"predecessor-version":[{"id":244686,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/244556\/revisions\/244686"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/244618"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=244556"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=244556"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=244556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}