{"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":"
\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 <\/p>\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 \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 \u4ece\u4e0a\u9762\u7684\u683c\u5f0f\u4e2d\uff1a<\/p>\n \u8981\u6d4f\u89c8\u793a\u4f8b\u6587\u4ef6\uff0c\u8f93\u5165\uff1a<\/p>\n \u8fd9\u662f\u5b9e\u9645\u53d1\u751f\u7684\uff1a<\/p>\n \u73b0\u5728\u8ba9\u6211\u4eec\u770b\u4e00\u4e2a\u4f8b\u5b50\u3002\u8fd9\u4e2a\u4f1a\u6bcf\u5929\u8fd0\u884c \/home\/aaronkilik\/bin\/backup.sh<\/span> \u811a\u672c\uff1a<\/p>\n \u5f53\u673a\u5668\u5728 backup.sh<\/span> \u671f\u671b\u88ab\u8fd0\u884c\u65f6\u662f\u5173\u673a\u7684\uff0canacron \u4f1a\u5728\u673a\u5668\u5f00\u673a\u5341\u5206\u949f\u4e4b\u540e\u8fd0\u884c\u5b83\uff0c\u800c\u4e0d\u7528\u518d\u7b49\u5f85 7 \u5929\u3002<\/p>\n \u8fd9\u91cc\u6709\u4e24\u4e2a\u4f60\u5e94\u8be5\u7406\u89e3\u7684 anacrontab \u6587\u4ef6\u7684\u91cd\u8981\u53d8\u91cf\uff1a<\/p>\n \u8fd9\u662f\u4f60\u7684 anacrontab \u6587\u4ef6\u53ef\u80fd\u770b\u4e0a\u53bb\u7684\u6837\u5b50\u3002<\/p>\n Anacron \u2013 \/etc\/anacrontab<\/span> \uff1a<\/p>\n \u4e0b\u9762\u662f cron \u4ee5\u53ca anacron \u7684\u6bd4\u8f83\uff0c\u5e2e\u52a9\u4f60\u7406\u89e3\u4f55\u65f6\u7528\u4ed6\u4eec\u5176\u4e2d\u4e00\u4e2a\u3002<\/p>\n cron \u548c anacron \u4e3b\u8981\u7684\u533a\u522b\u5728\u4e8e cron \u80fd\u5728\u90a3\u4e9b\u6301\u7eed\u8fd0\u884c\u7684\u673a\u5668\u4e0a\u6709\u6548\u5730\u8fd0\u884c\uff0c\u800c anacron \u662f\u9488\u5bf9\u90a3\u4e9b\u4f1a\u5728\u4e00\u5929\u5185\u6216\u8005\u4e00\u5468\u5185\u4f1a\u5173\u673a\u7684\u673a\u5668\u3002<\/p>\n \u5982\u679c\u4f60\u8fd8\u77e5\u9053\u5176\u4ed6\u65b9\u5f0f\uff0c\u8bf7\u5728\u8bc4\u8bba\u680f\u4e2d\u4e0e\u6211\u4eec\u5206\u4eab\u3002<\/p>\n \u539f\u6587\u5730\u5740\uff1a https:\/\/www.tecmint.com\/cron-vs-anacron-schedule-jobs-using-anacron-on-linux\/<\/a>\u200e<\/p>\n |