{"id":74902,"date":"2023-08-11T14:26:12","date_gmt":"2023-08-11T06:26:12","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=74902"},"modified":"2023-08-11T14:26:12","modified_gmt":"2023-08-11T06:26:12","slug":"cron-anacron-work","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/cron-anacron-work.html","title":{"rendered":"Linux \u4e2d\u600e\u4e48\u8bbe\u7f6e\u8ba1\u5212\u4efb\u52a1\uff1acron \u4e0e anacron"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u5728\u672c\u7bc7\u4e2d\uff0c\u6211\u4eec\u4f1a\u89e3\u91ca cron \u548c anacron\uff0c\u5e76\u5411\u4f60\u5c55\u793a\u5982\u4f55\u5728 Linux \u4e2d\u8bbe\u7f6e anacron\u3002\u6211\u4eec\u4e5f\u4f1a\u6bd4\u8f83\u8fd9\u4e24\u4e2a\u5de5\u5177\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

cron \u5728 Linux \u8bbe\u7f6e<\/strong><\/div>\n

cron - \u662f\u4e00\u4e2a\u7528\u4e8e\u8fd0\u884c\u8ba1\u5212\u4efb\u52a1\u5982\u7cfb\u7edf\u5907\u4efd\u3001\u66f4\u65b0\u7b49\u7684\u5b88\u62a4\u8fdb\u7a0b\u3002\u5b83\u9002\u5408\u5728\u90a3\u4e9b 24X7 \u4e0d\u95f4\u65ad\u8fd0\u884c\u7684\u673a\u5668\u5982\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\u7684\u8ba1\u5212\u4efb\u52a1\u3002<\/p>\n

\u547d\u4ee4\/\u811a\u672c\u88ab\u5199\u5728 cron \u4efb\u52a1\u811a\u672c\u4e2d\uff0c\u5b83\u662f\u5728crontab<\/span> \u6587\u4ef6\u4e2d\u88ab\u5b89\u6392\u7684\u3002\u7cfb\u7edf\u9ed8\u8ba4\u7684 cromtab<\/span> \u6587\u4ef6\u662f\/etc\/crontab<\/span> \uff0c\u4f46\u662f\u6bcf\u4e2a\u7528\u6237\u4e5f\u53ef\u4ee5\u521b\u5efa\u81ea\u5df1\u7684 cromtab<\/span> \u6587\u4ef6\u6765\u5728\u7279\u5b9a\u65f6\u95f4\u8fd0\u884c\u7528\u6237\u5b9a\u4e49\u7684\u547d\u4ee4\u3002<\/p>\n

\u8981\u521b\u5efa\u4e00\u4efd\u4e2a\u4ebacrontab<\/span> \u6587\u4ef6\uff0c\u53ea\u8981\u8f93\u5165\uff1a<\/p>\n

$ crontab -e\r\n<\/pre>\n

\"\"<\/p>\n

\u5982\u4f55\u5728 Linux \u4e2d\u8bbe\u7f6e anacron<\/strong><\/div>\n

anacron \u7528\u4e8e\u4ee5\u5929\u4e3a\u5355\u4f4d\u7684\u9891\u7387\u8fd0\u884c\u547d\u4ee4\u3002\u5b83\u7684\u5de5\u4f5c\u4e0e cron \u7a0d\u6709\u4e0d\u540c\uff0c\u5b83\u5047\u8bbe\u673a\u5668\u4e0d\u4f1a\u4e00\u76f4\u5f00\u673a<\/strong>\u3002<\/p>\n

cron \u4e5f\u9002\u5408\u5728\u90a3\u4e9b\u4e0d\u4f1a 24X7 \u8fd0\u884c\u5982\u7b14\u8bb0\u672c\u4ee5\u53ca\u684c\u9762\u7535\u8111\u7684\u673a\u5668\u4e0a\u8fd0\u884c\u6bcf\u65e5\u3001\u6bcf\u5468\u4ee5\u53ca\u6bcf\u6708\u7684\u8ba1\u5212\u4efb\u52a1\uff08LCTT \u8bd1\u6ce8\uff1a\u4e0d\u9002\u5408\u6309\u5c0f\u65f6\u3001\u5206\u949f\u6267\u884c\u4efb\u52a1\uff09\u3002<\/p>\n

\u5047\u8bbe\u4f60\u6709\u4e00\u4e2a\u8ba1\u5212\u4efb\u52a1\uff08\u6bd4\u5982\u5907\u4efd\u811a\u672c\uff09\u8981\u4f7f\u7528 cron \u5728\u6bcf\u5929\u534a\u591c\u8fd0\u884c\uff0c\u4e5f\u8bb8\u4f60\u4ee5\u53ca\u7761\u7740\uff0c\u90a3\u65f6\u4f60\u7684\u684c\u9762\/\u7b14\u8bb0\u672c\u7535\u8111\u5df2\u7ecf\u5173\u673a\u3002\u4f60\u7684\u5907\u4efd\u811a\u672c\u5c31\u4e0d\u4f1a\u88ab\u8fd0\u884c\u3002<\/p>\n

\u7136\u800c\uff0c\u5982\u679c\u4f60\u4f7f\u7528 anacron\uff0c\u4f60\u53ef\u4ee5\u786e\u4fdd\u5728\u4f60\u4e0b\u6b21\u5f00\u542f\u684c\u9762\/\u7b14\u8bb0\u672c\u7535\u8111\u7684\u65f6\u5019\uff0c\u5907\u4efd\u811a\u672c\u4f1a\u88ab\u6267\u884c\u3002<\/p>\n

anacron \u5982\u4f55\u5728 Linux \u5de5\u4f5c<\/strong><\/div>\n

anacron \u4efb\u52a1\u88ab\u5217\u5728 \/etc\/anacrontab<\/span> \u4e2d\uff0c\u4efb\u52a1\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u683c\u5f0f\uff08anacron \u6587\u4ef6\u4e2d\u7684\u6ce8\u91ca\u5fc5\u987b\u4ee5 #<\/span> \u53f7\u5f00\u59cb\uff09\u5b89\u6392\u3002<\/p>\n

period   delay   job-identifier   command\r\n<\/pre>\n

\u4ece\u4e0a\u9762\u7684\u683c\u5f0f\u4e2d\uff1a<\/p>\n