{"id":274841,"date":"2023-06-12T20:07:47","date_gmt":"2023-06-12T12:07:47","guid":{"rendered":"https:\/\/gulass.cn\/jjldsrwbzxwt.html"},"modified":"2023-06-12T20:07:47","modified_gmt":"2023-06-12T12:07:47","slug":"jjldsrwbzxwt","status":"publish","type":"post","link":"https:\/\/gulass.cn\/jjldsrwbzxwt.html","title":{"rendered":"\u89e3\u51b3Linux\u5b9a\u65f6\u4efb\u52a1\u4e0d\u6267\u884c\u95ee\u9898\u76848\u4e2a\u65b9\u6848"},"content":{"rendered":"

\u8fd1\u6765\uff0c\u6709\u4e0d\u5c11Linux<\/a>\u7cfb\u7edf<\/a>\u7ba1\u7406\u5458\u53cd\u6620\uff0c\u4ed6\u4eec\u8bbe\u7f6e\u4e86\u5b9a\u65f6\u4efb\u52a1\uff0c\u4f46\u662f\u4efb\u52a1\u5e76\u6ca1\u6709\u6309\u7167\u9884\u671f\u6267\u884c\u3002\u8fd9\u4e2a\u95ee\u9898\u770b\u4e0a\u53bb\u7b80\u5355linux \u5b9a\u65f6\u4efb\u52a1\u4e0d\u6267\u884c<\/strong>\uff0c\u5374\u8ba9\u5f88\u591a\u4eba\u5934\u75bc\u3002\u672c\u6587\u5c06\u4ece8\u4e2a\u65b9\u9762\u9010\u4e00\u5206\u6790\u8fd9\u4e2a\u95ee\u9898\uff0c\u5e76\u63d0\u4f9b\u8be6\u7ec6\u7684\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n

\u4e00\u3001\u68c0\u67e5cron\u670d\u52a1\u662f\u5426\u542f\u52a8<\/p>\n

cron\u670d\u52a1\u662fLinux\u7cfb\u7edf\u4e2d\u7528\u4e8e\u6267\u884c\u5b9a\u65f6\u4efb\u52a1\u7684\u670d\u52a1\uff0c\u5728\u4e00\u4e9bLinux\u53d1\u884c\u7248\u4e2d\u9ed8\u8ba4\u662f\u6ca1\u6709\u542f\u52a8\u7684\u3002\u5982\u679ccron\u670d\u52a1\u6ca1\u6709\u542f\u52a8\uff0c\u5219\u65e0\u6cd5\u6267\u884c\u5b9a\u65f6\u4efb\u52a1\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4<\/a>\u68c0\u67e5cron\u670d\u52a1\u662f\u5426\u5df2\u7ecf\u542f\u52a8\uff1a<\/p>\n

\n

bash\nsystemctl status cron\n<\/pre>\n<\/p>\n

\u5982\u679c\u8fd4\u56de\u7ed3\u679c\u4e2d\u663e\u793aActive: inactive (dead)\uff0c\u5219\u8bf4\u660ecron\u670d\u52a1\u6ca1\u6709\u542f\u52a8\uff0c\u9700\u8981\u624b\u52a8\u542f\u52a8cron\u670d\u52a1\uff1a<\/p>\n

\n

bash\nsystemctl start cron\n<\/pre>\n<\/p>\n

crontab \u5b9a\u65f6\u6267\u884cphp_linux \u5b9a\u65f6\u4efb\u52a1\u4e0d\u6267\u884c_linux crontab\u5b9a\u65f6\u6267\u884cphp<\/p>\n

\u4e8c\u3001\u68c0\u67e5\u5b9a\u65f6\u4efb\u52a1\u662f\u5426\u6b63\u786e\u8bbe\u7f6e<\/p>\n

\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528crontab\u547d\u4ee4\u6765\u8bbe\u7f6e\u5b9a\u65f6\u4efb\u52a1\u3002\u5728\u8bbe\u7f6e\u5b9a\u65f6\u4efb\u52a1\u4e4b\u524d\uff0c\u9700\u8981\u786e\u5b9a\u8981\u6267\u884c\u7684\u547d\u4ee4\u6216\u811a\u672c\uff0c\u5e76\u786e\u5b9a\u6267\u884c\u7684\u65f6\u95f4\u3002\u5728\u8bbe\u7f6e\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528crontab -l\u547d\u4ee4\u6765\u67e5\u770b\u5f53\u524d\u7528\u6237\u7684\u5b9a\u65f6\u4efb\u52a1\u5217\u8868\u3002<\/p>\n

\u5982\u679c\u5b9a\u65f6\u4efb\u52a1\u6ca1\u6709\u6309\u7167\u9884\u671f\u6267\u884c\uff0c\u5219\u9700\u8981\u68c0\u67e5\u4ee5\u4e0b\u51e0\u70b9\uff1a<\/p>\n

1.\u547d\u4ee4\u6216\u811a\u672c\u662f\u5426\u6b63\u786e\uff1b<\/p>\n

2.\u65f6\u95f4\u683c\u5f0f\u662f\u5426\u6b63\u786e\uff1b<\/p>\n

3.\u5b9a\u65f6\u4efb\u52a1\u662f\u5426\u88ab\u6ce8\u91ca\u6389\u4e86\u3002<\/p>\n

\u4e09\u3001\u68c0\u67e5\u7528\u6237\u6743\u9650<\/p>\n

\u5728Linux\u7cfb\u7edf\u4e2dlinux\u7cfb\u7edf\u754c\u9762\uff0c\u53ea\u6709\u5177\u6709\u8db3\u591f\u6743\u9650\u7684\u7528\u6237\u624d\u80fd\u591f\u6267\u884c\u67d0\u4e9b\u64cd\u4f5c\u3002\u5982\u679c\u5f53\u524d\u7528\u6237\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\uff0c\u5219\u53ef\u80fd\u4f1a\u5bfc\u81f4\u5b9a\u65f6\u4efb\u52a1\u65e0\u6cd5\u6267\u884c\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u5f53\u524d\u7528\u6237\u7684\u6743\u9650\uff1a<\/p>\n

\n

bash\nid\n<\/pre>\n<\/p>\n

\u5982\u679c\u5f53\u524d\u7528\u6237\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\uff0c\u5219\u9700\u8981\u4f7f\u7528sudo\u547d\u4ee4\u63d0\u5347\u6743\u9650\u3002<\/p>\n

\u56db\u3001\u68c0\u67e5\u73af\u5883\u53d8\u91cf<\/p>\n

\u5728\u6267\u884c\u5b9a\u65f6\u4efb\u52a1\u65f6\uff0c\u6709\u4e9b\u547d\u4ee4\u6216\u811a\u672c\u9700\u8981\u4f7f\u7528\u7279\u5b9a\u7684\u73af\u5883\u53d8\u91cf\u624d\u80fd\u6b63\u5e38\u5de5\u4f5c\u3002\u5982\u679c\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u4e0d\u6b63\u786e\uff0c\u5219\u53ef\u80fd\u4f1a\u5bfc\u81f4\u5b9a\u65f6\u4efb\u52a1\u65e0\u6cd5\u6267\u884c\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u5f53\u524d\u73af\u5883\u53d8\u91cf\uff1a<\/p>\n

\n

bash\nprintenv\n<\/pre>\n<\/p>\n

\u5982\u679c\u53d1\u73b0\u7f3a\u5c11\u5fc5\u8981\u7684\u73af\u5883\u53d8\u91cf\uff0c\u5219\u9700\u8981\u624b\u52a8\u8bbe\u7f6e\u3002<\/p>\n

\u4e94\u3001\u68c0\u67e5\u65e5\u5fd7\u6587\u4ef6<\/p>\n

\u5728Linux\u7cfb\u7edf\u4e2dLINUX\u793e\u533a\uff0c\u6240\u6709\u7684\u7cfb\u7edf\u64cd\u4f5c\u548c\u4e8b\u4ef6\u90fd\u4f1a\u88ab\u8bb0\u5f55\u5728\u65e5\u5fd7\u6587\u4ef6\u4e2d\u3002\u5982\u679c\u5b9a\u65f6\u4efb\u52a1\u6ca1\u6709\u6309\u7167\u9884\u671f\u6267\u884c\uff0c\u5219\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u65e5\u5fd7\u6587\u4ef6\u6765\u786e\u5b9a\u5177\u4f53\u539f\u56e0\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u7cfb\u7edf\u65e5\u5fd7\u6587\u4ef6\u4f4d\u4e8e\/var\/log\u76ee\u5f55\u4e0b\u3002<\/p>\n

\u516d\u3001\u68c0\u67e5\u78c1\u76d8\u7a7a\u95f4<\/p>\n

\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u78c1\u76d8\u7a7a\u95f4\u4e0d\u8db3\u53ef\u80fd\u4f1a\u5bfc\u81f4\u5404\u79cd\u95ee\u9898\uff0c\u5305\u62ec\u65e0\u6cd5\u6267\u884c\u5b9a\u65f6\u4efb\u52a1\u3002\u53ef\u4ee5\u4f7f\u7528df\u547d\u4ee4\u6765\u67e5\u770b\u5f53\u524d\u78c1\u76d8\u7a7a\u95f4\u4f7f\u7528\u60c5\u51b5\uff1a<\/p>\n

\n

bash\ndf -h\n<\/pre>\n<\/p>\n

\u5982\u679c\u78c1\u76d8\u7a7a\u95f4\u4e0d\u8db3\uff0c\u5219\u9700\u8981\u6e05\u7406\u4e00\u4e9b\u4e0d\u5fc5\u8981\u7684\u6587\u4ef6\u6216\u8005\u6269\u5c55\u78c1\u76d8\u7a7a\u95f4\u3002<\/p>\n

\u4e03\u3001\u68c0\u67e5\u9632\u706b\u5899\u8bbe\u7f6e<\/p>\n

\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u9632\u706b\u5899\u53ef\u80fd\u4f1a\u963b\u6b62\u67d0\u4e9b\u7f51\u7edc\u8fde\u63a5\u6216\u8005\u7aef\u53e3\u8bbf\u95ee\u3002\u5982\u679c\u5b9a\u65f6\u4efb\u52a1\u9700\u8981\u8bbf\u95ee\u7f51\u7edc\u6216\u8005\u67d0\u4e9b\u7279\u5b9a\u7684\u7aef\u53e3\uff0c\u5219\u9700\u8981\u68c0\u67e5\u9632\u706b\u5899\u8bbe\u7f6e\u662f\u5426\u6b63\u786e\u3002\u53ef\u4ee5\u4f7f\u7528iptables\u547d\u4ee4\u6765\u67e5\u770b\u5f53\u524d\u9632\u706b\u5899\u89c4\u5219\uff1a<\/p>\n

\n

bash\niptables -L\n<\/pre>\n<\/p>\n

\u5982\u679c\u53d1\u73b0\u9632\u706b\u5899\u8bbe\u7f6e\u4e0d\u6b63\u786e\uff0c\u5219\u9700\u8981\u624b\u52a8\u4fee\u6539\u3002<\/p>\n

\u516b\u3001\u68c0\u67e5\u7cfb\u7edf\u65f6\u95f4<\/p>\n

\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u7cfb\u7edf\u65f6\u95f4\u4e0d\u6b63\u786e\u53ef\u80fd\u4f1a\u5bfc\u81f4\u5404\u79cd\u95ee\u9898\uff0c\u5305\u62ec\u65e0\u6cd5\u6267\u884c\u5b9a\u65f6\u4efb\u52a1\u3002\u53ef\u4ee5\u4f7f\u7528date\u547d\u4ee4\u6765\u67e5\u770b\u5f53\u524d\u7cfb\u7edf\u65f6\u95f4\uff1a<\/p>\n

\n

bash\ndate\n<\/pre>\n<\/p>\n

\u5982\u679c\u53d1\u73b0\u7cfb\u7edf\u65f6\u95f4\u4e0d\u6b63\u786e\uff0c\u5219\u9700\u8981\u624b\u52a8\u4fee\u6539\u3002<\/p>\n

\u603b\u7ed3<\/p>\n

Linux\u5b9a\u65f6\u4efb\u52a1\u4e0d\u6267\u884c\u53ef\u80fd\u662f\u7531\u4e8e\u591a\u79cd\u539f\u56e0\u5bfc\u81f4\u7684\uff0c\u672c\u6587\u4ece8\u4e2a\u65b9\u9762\u9010\u4e00\u8fdb\u884c\u4e86\u5206\u6790linux \u5b9a\u65f6\u4efb\u52a1\u4e0d\u6267\u884c<\/strong>\uff0c\u5e76\u63d0\u4f9b\u4e86\u8be6\u7ec6\u7684\u89e3\u51b3\u65b9\u6848\u3002\u5e0c\u671b\u672c\u6587\u5bf9\u5927\u5bb6\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u5982\u679ccron\u670d\u52a1\u6ca1\u6709\u542f\u52a8\uff0c\u5219\u65e0\u6cd5\u6267\u884c\u5b9a\u65f6\u4efb\u52a1\u3002\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528crontab\u547d\u4ee4\u6765\u8bbe\u7f6e\u5b9a\u65f6\u4efb\u52a1\u3002\u5982\u679c\u5b9a\u65f6\u4efb\u52a1\u6ca1\u6709\u6309\u7167\u9884\u671f\u6267\u884c\uff0c\u5219\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u65e5\u5fd7\u6587\u4ef6\u6765\u786e\u5b9a\u5177\u4f53\u539f\u56e0\u3002\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u7cfb\u7edf\u65f6\u95f4\u4e0d\u6b63\u786e\u53ef\u80fd\u4f1a\u5bfc\u81f4\u5404\u79cd\u95ee\u9898\uff0c\u5305\u62ec\u65e0\u6cd5\u6267\u884c\u5b9a\u65f6\u4efb\u52a1\u3002Linux\u5b9a\u65f6\u4efb\u52a1\u4e0d\u6267\u884c\u53ef\u80fd\u662f\u7531\u4e8e\u591a\u79cd\u539f\u56e0\u5bfc\u81f4\u7684\uff0c\u672c\u6587\u4ece8\u4e2a\u65b9\u9762\u9010\u4e00\u8fdb\u884c\u4e86\u5206\u6790\uff0c\u5e76\u63d0\u4f9b\u4e86\u8be6\u7ec6\u7684\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n","protected":false},"author":1,"featured_media":274842,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-274841","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/274841","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=274841"}],"version-history":[{"count":0,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/274841\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/274842"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=274841"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=274841"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=274841"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}