{"id":1702,"date":"2019-05-27T23:43:12","date_gmt":"2019-05-27T15:43:12","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=1702"},"modified":"2022-05-17T01:31:21","modified_gmt":"2022-05-16T17:31:21","slug":"crontab","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/crontab","title":{"rendered":"crontab\u547d\u4ee4 – \u7ba1\u7406\u5b9a\u65f6\u8ba1\u5212\u4efb\u52a1"},"content":{"rendered":"\n

crontab\u547d\u4ee4\u6765\u81ea\u4e8e\u82f1\u6587\u8bcd\u7ec4\u201ccron table\u201d\u7684\u7f29\u5199\uff0c\u5176\u529f\u80fd\u662f\u7ba1\u7406\u5b9a\u65f6\u8ba1\u5212\u4efb\u52a1\u3002\u5b9a\u65f6\u8ba1\u5212\u4efb\u52a1\uff0c\u6545\u540d\u610f\u601d\u5c31\u8ba1\u5212\u597d\u7684\u4efb\u52a1\uff0c\u5230\u4e86\u65f6\u95f4\u5c31\u4f1a\u81ea\u52a8\u6267\u884c\uff0c\u5728Linux\u7cfb\u7edf\u4e2d\u7684crond\u662f\u4e00\u4e2a\u5b9a\u65f6\u8ba1\u5212\u4efb\u52a1\u670d\u52a1\uff0c\u7528\u6237\u53ea\u8981\u80fd\u591f\u6309\u7167\u6b63\u786e\u7684\u683c\u5f0f\uff08\u5206\u3001\u65f6\u3001\u65e5\u3001\u6708\u3001\u661f\u671f\u3001\u547d\u4ee4\uff09\u5199\u5165\u5230\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u90a3\u4e48\u5c31\u4f1a\u6309\u7167\u9884\u5b9a\u7684\u5468\u671f\u65f6\u95f4\u81ea\u52a8\u7684\u6267\u884c\u4e0b\u53bb\uff0c\u800ccrontab\u547d\u4ee4\u5219\u662f\u7528\u4e8e\u914d\u7f6e\u7684\u5de5\u5177\u540d\u79f0\u3002<\/p>\n\n\n\n

\u7531\u4e8e\u5b9a\u65f6\u8ba1\u5212\u4efb\u52a1\u975e\u5e38\u590d\u6742\uff0c\u672c\u8bcd\u6761\u4ec5\u4f5c\u7b80\u5355\u4ecb\u7ecd\uff0c\u5efa\u8bae\u9605\u8bfb\u4e66\u7c4d\u300aLinux\u5c31\u8be5\u8fd9\u4e48\u5b66\u300b\u7b2c4\u7ae0\u8282<\/a>\u3002<\/p>\n\n\n\n

\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>crontab [\u53c2\u6570] <\/p>\n\n\n\n

\u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n

-e<\/td>\u7f16\u8f91\u4efb\u52a1<\/td><\/tr>
-l<\/td>\u5217\u51fa\u4efb\u52a1<\/td><\/tr>
-r<\/td>\u5220\u9664\u4efb\u52a1<\/td><\/tr>
-u<\/td>\u6307\u5b9a\u7528\u6237\u540d\u5b57<\/td><\/tr>
--help<\/td>\u663e\u793a\u5e2e\u52a9\u4fe1\u606f<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n

\u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n

\u7ba1\u7406\u5f53\u524d\u7528\u6237\u7684\u8ba1\u5212\u4efb\u52a1\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# crontab -e  <\/strong><\/pre>\n\n\n\n

\u7ba1\u7406\u6307\u5b9a\u7528\u6237\u7684\u8ba1\u5212\u4efb\u52a1\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# crontab -e -u linuxprobe<\/strong><\/pre>\n\n\n\n

\u67e5\u770b\u5f53\u524d\u7528\u6237\u7684\u5df2\u6709\u8ba1\u5212\u4efb\u52a1\u5217\u8868\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# crontab -l <\/strong>\n25 3 * * 1,3,5 \/usr\/bin\/tar -czvf backup.tar.gz \/home\/wwwroot  <\/pre>\n","protected":false},"excerpt":{"rendered":"

crontab\u547d\u4ee4\u6765\u81ea\u4e8e\u82f1\u6587\u8bcd\u7ec4\u201ccron table\u201d\u7684\u7f29\u5199\uff0c\u5176\u529f\u80fd\u662f\u7ba1\u7406\u5b9a\u65f6\u8ba1\u5212\u4efb\u52a1\u3002\u5b9a\u65f6\u8ba1\u5212\u4efb\u52a1\uff0c\u6545\u540d\u610f […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/1702"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=1702"}],"version-history":[{"count":32,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/1702\/revisions"}],"predecessor-version":[{"id":9767,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/1702\/revisions\/9767"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=1702"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=1702"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=1702"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}