{"id":49459,"date":"2024-12-02T15:30:18","date_gmt":"2024-12-02T07:30:18","guid":{"rendered":"https:\/\/fwq.ai\/blog\/49459\/"},"modified":"2024-12-02T15:30:18","modified_gmt":"2024-12-02T07:30:18","slug":"crontab%e5%a6%82%e4%bd%95%e5%ae%9e%e7%8e%b0%e5%ae%9a%e6%97%b6%e4%bb%bb%e5%8a%a1%ef%bc%9a%e4%bb%8e2130%e5%bc%80%e5%a7%8b%ef%bc%8c%e6%af%8f8%e5%88%86%e9%92%9f%e6%89%a7%e8%a1%8c%e4%b8%80%e6%ac%a1","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/49459\/","title":{"rendered":"Crontab\u5982\u4f55\u5b9e\u73b0\u5b9a\u65f6\u4efb\u52a1\uff1a\u4ece21:30\u5f00\u59cb\uff0c\u6bcf8\u5206\u949f\u6267\u884c\u4e00\u6b21\uff0c\u6301\u7eed\u523022:30\uff1f"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>Crontab\u5982\u4f55\u5b9e\u73b0\u5b9a\u65f6\u4efb\u52a1\uff1a\u4ece21:30\u5f00\u59cb\uff0c\u6bcf8\u5206\u949f\u6267\u884c\u4e00\u6b21\uff0c\u6301\u7eed\u523022:30\uff1f<\/h1>\n<p>\u6765\u5230\u7c73\u4e91\u7684\u5927\u5bb6\uff0c\u76f8\u4fe1\u90fd\u662f\u7f16\u7a0b\u5b66\u4e60\u7231\u597d\u8005\uff0c\u5e0c\u671b\u5728\u8fd9\u91cc\u5b66\u4e60\u6587\u7ae0\u76f8\u5173\u7f16\u7a0b\u77e5\u8bc6\u3002\u4e0b\u9762\u672c\u7bc7\u6587\u7ae0\u5c31\u6765\u5e26\u5927\u5bb6\u804a\u804a\u300aCrontab\u5982\u4f55\u5b9e\u73b0\u5b9a\u65f6\u4efb\u52a1\uff1a\u4ece21:30\u5f00\u59cb\uff0c\u6bcf8\u5206\u949f\u6267\u884c\u4e00\u6b21\uff0c\u6301\u7eed\u523022:30\uff1f\u300b\uff0c\u4ecb\u7ecd\u4e00\u4e0b\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5b9e\u6218\u5f00\u53d1\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241202\/1733115976674d404847e4f.jpg\" class=\"aligncenter\" title=\"Crontab\u5982\u4f55\u5b9e\u73b0\u5b9a\u65f6\u4efb\u52a1\uff1a\u4ece21:30\u5f00\u59cb\uff0c\u6bcf8\u5206\u949f\u6267\u884c\u4e00\u6b21\uff0c\u6301\u7eed\u523022:30\uff1f\u63d2\u56fe\" alt=\"Crontab\u5982\u4f55\u5b9e\u73b0\u5b9a\u65f6\u4efb\u52a1\uff1a\u4ece21:30\u5f00\u59cb\uff0c\u6bcf8\u5206\u949f\u6267\u884c\u4e00\u6b21\uff0c\u6301\u7eed\u523022:30\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>crond \u5982\u4f55\u5b9e\u73b0\u4ece\u6307\u5b9a\u65f6\u95f4\u8d77\uff0c\u5faa\u73af\u6267\u884c\u4efb\u52a1<\/strong><\/p>\n<p><strong>\u95ee\u9898\uff1a<\/strong><\/p>\n<p>\u5982\u4f55\u4f7f\u7528 crond \u8bbe\u7f6e\u4efb\u52a1\uff0c\u4ece\u665a\u4e0a 21:30 \u5f00\u59cb\uff0c\u6bcf\u9694 8 \u5206\u949f\u6267\u884c\u4e00\u6b21\uff0c\u76f4\u81f3 22:30 \u7ed3\u675f\uff1f<\/p>\n<p><strong>\u89e3\u7b54\uff1a<\/strong><\/p>\n<p><strong>\u6b65\u9aa4 1\uff1a\u521b\u5efa\u53ef\u6267\u884c\u811a\u672c<\/strong><\/p>\n<ul>\n<li>\u5c06\u8981\u6267\u884c\u7684\u4efb\u52a1\u5199\u5165\u4e00\u4e2a\u540d\u4e3a schedule.sh \u7684\u72ec\u7acb .sh \u6587\u4ef6\u4e2d\u3002<\/li>\n<li>\u5728 schedule.sh \u4e2d\u4f7f\u7528 sleep \u547d\u4ee4\u7b49\u5f85 8 \u5206\u949f\uff1a<\/li>\n<\/ul>\n<pre>#!\/bin\/bash\nsleep 480  # \u7b49\u5f85 8 \u5206\u949f\uff08480 \u79d2\uff09<\/pre>\n<p><strong>\u6b65\u9aa4 2\uff1a\u8bbe\u7f6e crontab<\/strong><\/p>\n<ul>\n<li>\u5728 crontab \u4e2d\uff0c\u4ece 21:30 \u8d77\u6bcf\u5929\u8fd0\u884c schedule.sh \u811a\u672c\u4e00\u6b21\uff1a<\/li>\n<\/ul>\n<pre>30 21 * * * \/path\/to\/schedule.sh<\/pre>\n<p><strong>\u8bf4\u660e\uff1a<\/strong><\/p>\n<ul>\n<li>crontab \u8868\u8fbe\u5f0f\u4e2d\u7684\u65f6\u95f4\u5b57\u6bb5\uff0830 21\uff09\u8868\u793a\u6bcf\u5929\u665a\u4e0a 21:30\u3002<\/li>\n<li>&#8221; * &#8221; \u8868\u793a\u5728\u8be5\u5b57\u6bb5\u4e2d\u5339\u914d\u4efb\u4f55\u503c\uff0c\u5373\u6bcf\u5929\u3002<\/li>\n<li>&#8220;\/path\/to\/schedule.sh&#8221; \u662f\u811a\u672c\u7684\u5b8c\u6574\u8def\u5f84\u3002<\/li>\n<\/ul>\n<p><strong>\u6267\u884c\u6d41\u7a0b\uff1a<\/strong><\/p>\n<ul>\n<li>\u665a\u4e0a 21:30\uff0ccrond \u5c06\u8fd0\u884c schedule.sh \u811a\u672c\u3002<\/li>\n<li>\u811a\u672c\u5c06\u7b49\u5f85 8 \u5206\u949f\uff08480 \u79d2\uff09\u3002<\/li>\n<li>\u6b64\u540e\uff0c\u811a\u672c\u5c06\u7ed3\u675f\uff0ccrond \u5c06\u5728 21:38 \u518d\u6b21\u8fd0\u884c\u76f8\u540c\u7684\u811a\u672c\uff0c\u76f4\u5230\u8fbe\u5230 22:30\u3002<\/li>\n<\/ul>\n<p>\u4eca\u5929\u5173\u4e8e\u300aCrontab\u5982\u4f55\u5b9e\u73b0\u5b9a\u65f6\u4efb\u52a1\uff1a\u4ece21:30\u5f00\u59cb\uff0c\u6bcf8\u5206\u949f\u6267\u884c\u4e00\u6b21\uff0c\u6301\u7eed\u523022:30\uff1f\u300b\u7684\u5185\u5bb9\u5c31\u4ecb\u7ecd\u5230\u8fd9\u91cc\u4e86\uff0c\u662f\u4e0d\u662f\u5b66\u8d77\u6765\u4e00\u76ee\u4e86\u7136\uff01\u60f3\u8981\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u5185\u5bb9\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Crontab\u5982\u4f55\u5b9e\u73b0\u5b9a\u65f6\u4efb\u52a1\uff1a\u4ece21:30\u5f00\u59cb\uff0c\u6bcf8\u5206\u949f\u6267\u884c\u4e00\u6b21\uff0c\u6301\u7eed\u523022:30\uff1f \u6765\u5230\u7c73\u4e91\u7684\u5927\u5bb6\uff0c\u76f8\u4fe1\u90fd\u662f\u7f16\u7a0b\u5b66\u4e60\u7231\u597d\u8005\uff0c\u5e0c\u671b\u5728\u8fd9\u91cc\u5b66\u4e60\u6587\u7ae0\u76f8\u5173\u7f16\u7a0b\u77e5\u8bc6\u3002\u4e0b\u9762\u672c\u7bc7\u6587\u7ae0\u5c31\u6765\u5e26\u5927\u5bb6\u804a\u804a\u300aCrontab\u5982\u4f55\u5b9e\u73b0\u5b9a\u65f6\u4efb\u52a1\uff1a\u4ece21:30\u5f00\u59cb\uff0c\u6bcf8\u5206\u949f\u6267\u884c\u4e00\u6b21\uff0c\u6301\u7eed\u523022:30\uff1f\u300b\uff0c\u4ecb\u7ecd\u4e00\u4e0b\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5b9e\u6218\u5f00\u53d1\uff01 crond \u5982\u4f55\u5b9e\u73b0\u4ece\u6307\u5b9a\u65f6\u95f4\u8d77\uff0c\u5faa\u73af\u6267\u884c\u4efb\u52a1 \u95ee\u9898\uff1a \u5982\u4f55\u4f7f\u7528 crond \u8bbe\u7f6e\u4efb\u52a1\uff0c\u4ece\u665a\u4e0a 21:30 \u5f00\u59cb\uff0c\u6bcf\u9694 8 \u5206\u949f\u6267\u884c\u4e00\u6b21\uff0c\u76f4\u81f3 22:30 \u7ed3\u675f\uff1f \u89e3\u7b54\uff1a \u6b65\u9aa4 1\uff1a\u521b\u5efa\u53ef\u6267\u884c\u811a\u672c \u5c06\u8981\u6267\u884c\u7684\u4efb\u52a1\u5199\u5165\u4e00\u4e2a\u540d\u4e3a schedule.sh \u7684\u72ec\u7acb .sh \u6587\u4ef6\u4e2d\u3002 \u5728 schedule.sh \u4e2d\u4f7f\u7528 sleep \u547d\u4ee4\u7b49\u5f85 8 \u5206\u949f\uff1a #!\/bin\/bash sleep 480 # \u7b49\u5f85 8 \u5206\u949f\uff08480 \u79d2\uff09 \u6b65\u9aa4 2\uff1a\u8bbe\u7f6e crontab \u5728 crontab \u4e2d\uff0c\u4ece 21:30 \u8d77\u6bcf\u5929\u8fd0\u884c schedule.sh \u811a\u672c\u4e00\u6b21\uff1a 30 21 * * * \/path\/to\/schedule.sh \u8bf4\u660e\uff1a crontab [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-49459","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/49459","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=49459"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/49459\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=49459"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=49459"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=49459"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}