{"id":289029,"date":"2023-12-21T05:36:08","date_gmt":"2023-12-20T21:36:08","guid":{"rendered":"https:\/\/lrxjmw.cn\/qszwlfwtsyjq.html"},"modified":"2023-12-21T05:36:08","modified_gmt":"2023-12-20T21:36:08","slug":"qszwlfwtsyjq","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/qszwlfwtsyjq.html","title":{"rendered":"\u8f7b\u677e\u638c\u63e1Linux\u670d\u52a1\uff1a10\u6761\u5b9e\u7528\u6280\u5de7"},"content":{"rendered":"

\u5728\u5b66\u4e60\u5982\u4f55\u719f\u7ec3\u4f7f\u7528Linux<\/a>\u64cd\u4f5c\u7cfb\u7edf<\/a>\u65f6\uff0c\u8bf7\u8f7b\u677e\u638c\u63e1\u8fd9\u4e9b\u5b9e\u7528\u6280\u5de7\uff0c\u4e86\u89e3\u60a8\u6b63\u5728\u8fd0\u884c\u7684\u6240\u6709\u670d\u52a1\u4fe1\u606f\uff0c\u4ee5\u4fbf\u66f4\u9ad8\u6548\u5730\u8fdb\u884c\u7cfb\u7edf\u7ba1\u7406\u4e0e\u4fdd\u517b\u3002\u4ee5\u4e0b\u7ed9\u60a8\u5e26\u676510\u6761\u7b80\u660e\u4e14\u6613\u5b9e\u73b0\u7684\u67e5\u770bLinux\u670d\u52a1\u77e5\u8bc6\u3002<\/p>\n

\u65b9\u6cd5\u4e00\uff1a\u4f7f\u7528systemctl\u547d\u4ee4<\/a><\/b><\/p>\n

\u60a8\u597d\uff0c\u8ba9\u6211\u4eec\u5229\u7528\u7b80\u5355\u6613\u884c\u7684systemctl\u6307\u4ee4\uff0c\u5feb\u901f\u4e14\u4fbf\u6377\u5730\u67e5\u8be2\u5e76\u7ba1\u7406\u60a8\u7684\u7cfb\u7edf\u670d\u52a1\u5427\uff01\u53ea\u9700\u6309\u7167\u4ee5\u4e0b\u51e0\u6b65\u64cd\u4f5c\uff0c\u5373\u53ef\u7acb\u5373\u638c\u63e1\u6240\u6709\u5f53\u524d\u6b63\u5728\u6267\u884c\u4efb\u52a1\u7684\u8be6\u7ec6\u4fe1\u606f\u3002<\/p>\n

```<\/p>\n

\u73b0\u5728\uff0c\u8bf7\u5927\u5bb6\u5b66\u4e60\u5982\u4f55\u4fbf\u6377\u5730\u67e5\u627e\u5168\u90e8\u670d\u52a1\u4fe1\u606f——\u53ea\u9700\u8f7b\u70b9\u6307\u4ee4\"type=service\"\u5373\u53ef\u5b9e\u73b0\u3002<\/p>\n

\u8be5\u547d\u4ee4\u4f1a\u663e\u793a\u51fa\u6240\u6709\u6b63\u5728\u8fd0\u884c\u7684\u670d\u52a1\u4ee5\u53ca\u5176\u72b6\u6001\u3002<\/p>\n

\u65b9\u6cd5\u4e8c\uff1a\u4f7f\u7528service\u547d\u4ee4<\/b><\/p>\n

\u5c0a\u656c\u7684\u7528\u6237\uff0c\u8bf7\u653e\u5fc3\uff01\u672c\u516c\u53f8\u8bbe\u6709\u4fbf\u6377\u5b9e\u7528\u7684\"\u670d\u52a1\"\u547d\u4ee4\uff0c\u53ef\u52a9\u60a8\u8fc5\u901f\u638c\u63e1\u76ee\u524d\u8fd0\u884c\u4e2d\u7684\u5168\u90e8\u670d\u52a1\u3002\u53ea\u9700\u8981\u7b80\u5355\u8f93\u5165\u4e0b\u5217\u6307\u4ee4\u5c31\u80fd\u64cd\u4f5c\u5566\uff5e<\/p>\n

service --status-all<\/p>\n

\u5728\u6b64\u64cd\u4f5c\u4e0b\uff0c\u60a8\u53ef\u4ee5\u76f4\u89c2\u5730\u89c2\u5bdf\u5230\u6240\u6709\u6b63\u5728\u8fd0\u884c\u7684\u670d\u52a1\u72b6\u6001\u4ee5\u53ca\u5176\u72b6\u6001\u7684\u52a8\u6001\u53d8\u5316\u3002\u5b83\u5c06\u8fd9\u4e9b\u4fe1\u606f\u4ee5+\/-\u8868\u793a\u51fa\u6765\u3002<\/p>\n

\u65b9\u6cd5\u4e09\uff1a\u4f7f\u7528ps\u547d\u4ee4<\/b><\/p>\n

\u656c\u7231\u7684\u4f7f\u7528\u8005linux \u67e5\u770b\u670d\u52a1<\/strong>linux\u670d\u52a1\u5668\u642d\u5efa\uff0c\u60a8\u53ef\u901a\u8fc7PS\u6307\u4ee4\u5bf9\u672c\u673a\u8fd0\u884c\u4efb\u52a1\u8fdb\u884c\u68c0\u67e5\u3002\u82e5\u9700\u83b7\u77e5\u6307\u5b9a\u670d\u52a1\u5173\u8054\u8fdb\u7a0b\u8be6\u60c5\uff0c\u4ee5\u4e0b\u65b9\u6cd5\u4f9b\u60a8\u67e5\u9605\uff1a<\/p>\n

\u5c0a\u656c\u7684\u8bfb\u8005\uff0c\u6211\u4eec\u5efa\u8bae\u60a8\u5c1d\u8bd5\u8fd0\u884c\"ps -ef | grep -E systemd|sysvinit|upstart\"\uff0c\u6216\u8bb8\u5bf9\u89e3\u51b3\u95ee\u9898\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n

\u8be5\u547d\u4ee4\u4f1a\u663e\u793a\u51fa\u6240\u6709\u4e0e\u670d\u52a1\u76f8\u5173\u7684\u8fdb\u7a0b\u4fe1\u606f\u3002<\/p>\n

\u67e5\u770b\u670d\u52a1\u5668\u65f6\u95f4_linux \u67e5\u770b\u670d\u52a1_\u67e5\u770b\u670d\u52a1\u5668ip\u5730\u5740\u547d\u4ee4<\/p>\n

\u65b9\u6cd5\u56db\uff1a\u4f7f\u7528netstat\u547d\u4ee4<\/b><\/p>\n

\u8bf7\u5229\u7528netstat\u547d\u4ee4\u67e5\u8be2\u8be6\u7ec6\u7684\u7f51\u7edc\u8fde\u63a5\u4fe1\u606f\u5427linux\u64cd\u4f5c\u7cfb\u7edf\u6559\u7a0b\uff0c\u5176\u4e2d\u5305\u62ec\u4e86\u8def\u5f84\u5217\u8868\u548c\u901a\u4fe1\u63a5\u53e3\u4ecb\u7ecd\u5462\u3002\u5982\u60f3\u4e86\u89e3\u4fa6\u542c\u7aef\u53e3\u5bf9\u5e94\u7684\u670d\u52a1\u60c5\u51b5\uff0c\u656c\u8bf7\u53c2\u7167\u5982\u4e0b\u65b9\u6cd5\uff1a<\/p>\n

netstat -tlnp<\/p>\n

\u8fd9\u6b3e\u7cbe\u81f4\u7cbe\u5de7\u7684\u8bbe\u5907\u80fd\u795e\u5668\u822c\u76f4\u89c2\u5c55\u793a\u60a8\u6240\u76d1\u63a7\u7684TCP\u53caUDP\u7aef\u53e3\u53ca\u5176\u76f8\u5173\u670d\u52a1\u5185\u5bb9\u54e6\uff01<\/p>\n

\u65b9\u6cd5\u4e94\uff1a\u4f7f\u7528lsof\u547d\u4ee4<\/b><\/p>\n

\u82e5\u60a8\u60f3\u67e5\u770b\u6240\u6709\u7684\u670d\u52a1\u6587\u6863\uff0c\u5efa\u8bae\u60a8\u8bd5\u8bd5llsof\u8fd9\u4e2a\u547d\u4ee4\u6765\u83b7\u53d6\u6587\u4ef6\u6e05\u5355\u5e76\u8fdb\u884c\u67e5\u9605\u3002<\/p>\n

lsof -i<\/p>\n

\u8be5\u547d\u4ee4\u4f1a\u663e\u793a\u51fa\u6240\u6709\u4e0e\u670d\u52a1\u76f8\u5173\u7684\u7f51\u7edc\u8fde\u63a5\u6587\u4ef6\u3002<\/p>\n

\u65b9\u6cd5\u516d\uff1a\u67e5\u770b\u670d\u52a1\u542f\u52a8\u811a\u672c<\/b><\/p>\n

\u975e\u5e38\u611f\u8c22\u60a8\u7ed9\u4e88\u6211\u4eec\u4ea7\u54c1\u7684\u5173\u6ce8\uff01\u6211\u4eec\u5df2\u7ecf\u9488\u5bf9Linux\u7cfb\u7edf\u4e2d\u5404\u7c7b\u670d\u52a1\uff0c\u7cbe\u5fc3\u7f16\u5199\u4e86\u5bf9\u5e94\u7684\u542f\u52a8\u811a\u672c\u3002\u5982\u6709\u9700\u8981\u4e86\u89e3\u67d0\u4e00\u670d\u52a1\u66f4\u5177\u4f53\u7684\u542f\u52a8\u4fe1\u606f\uff0c\u656c\u8bf7\u53c2\u9605\u4ee5\u4e0b\u76f8\u5173\u6307\u5bfc\u8fdb\u884c\u64cd\u4f5c\u8c03\u6574\u3002<\/p>\n

ls \/etc\/init.d\/<\/p>\n

\u5c0a\u656c\u7684\u7528\u6237\uff0c\u8bf7\u501f\u6b64\u6307\u5f15\u6765\u4fbf\u6377\u5730\u67e5\u9605\/etc\/init.d\u6587\u4ef6\u5939\u5185\u6240\u6709\u7684\u542f\u52a8\u811a\u672c\u5427\u3002<\/p>\n

\u65b9\u6cd5\u4e03\uff1a\u67e5\u770b\u670d\u52a1\u914d\u7f6e\u6587\u4ef6<\/b><\/p>\n

\u5c0a\u656c\u7684\u7528\u6237\uff0c\u60a8\u597d\uff01\u6211\u4eec\u5df2\u4e3a\u6bcf\u9879\u670d\u52a1\u51c6\u5907\u4e86\u4e13\u7528\u914d\u7f6e\u6587\u4ef6\uff0c\u671f\u5f85\u52a9\u60a8\u5168\u9762\u4e86\u89e3\u670d\u52a1\u7ec6\u8282\u3002\u82e5\u8981\u67e5\u8be2\u67d0\u9879\u7279\u5b9a\u670d\u52a1\u7684\u914d\u7f6e\u6587\u4ef6\u5730\u5740\uff0c\u5efa\u8bae\u67e5\u9605\u5982\u4e0b\u5c0f\u8d34\u58eb\uff1a<\/p>\n

\u67e5\u770b\u670d\u52a1\u5668\u65f6\u95f4_\u67e5\u770b\u670d\u52a1\u5668ip\u5730\u5740\u547d\u4ee4_linux \u67e5\u770b\u670d\u52a1<\/p>\n

\u4eb2\u7231\u7684\u7528\u6237\uff0c\u5982\u9700\u5f97\u5230\u6240\u9700\u7684\u8f93\u51fa\u4fe1\u606f\uff0c\u8bf7\u5c1d\u8bd5\u8fd0\u884csystemctl show\u547d\u4ee4\u5e76\u52a0\u4e0aFragmentPath\u53c2\u6570\u3002<\/p>\n

\u5c06<service_name>\u66ff\u6362\u4e3a\u5177\u4f53\u7684\u670d\u52a1\u540d\u5373\u53ef\u3002<\/p>\n

\u65b9\u6cd5\u516b\uff1a\u67e5\u770b\u7cfb\u7edf\u65e5\u5fd7<\/b><\/p>\n

\u4eb2\u7231\u7684\u7528\u6237\uff0c\u5982\u9700\u66f4\u5168\u9762\u7684\u670d\u52a1\u4fe1\u606f\uff0c\u5efa\u8bae\u60a8\u67e5\u9605\u7cfb\u7edf\u65e5\u5fd7\u3002\u4ee5\u4e0b\u4e3a\u67e5\u9605\u6d41\u7a0b\uff1a<\/p>\n

journalctl<\/p>\n

\u8be5\u547d\u4ee4\u4f1a\u663e\u793a\u51fa\u7cfb\u7edf\u65e5\u5fd7\u4e2d\u6240\u6709\u7684\u5185\u5bb9\u3002<\/p>\n

\u65b9\u6cd5\u4e5d\uff1a\u67e5\u770b\u8fdb\u7a0b\u6811<\/b><\/p>\n

\u8f7b\u89e6\u5c4f\u5e55linux \u67e5\u770b\u670d\u52a1<\/strong>\uff0c\u4fbf\u80fd\u76f4\u63a5\u638c\u63e1\u6b64\u523b\u6b63\u5728\u8fd0\u884c\u7684\u670d\u52a1\u53ca\u5176\u76f8\u5173\u5b50\u8fdb\u7a0b\u4fe1\u606f\u3002<\/p>\n

pstree<\/p>\n

\u8be5\u547d\u4ee4\u4f1a\u663e\u793a\u51fa\u5f53\u524d\u7cfb\u7edf\u7684\u8fdb\u7a0b\u6811\u3002<\/p>\n

\u65b9\u6cd5\u5341\uff1a\u67e5\u770b\u670d\u52a1\u7aef\u53e3<\/b><\/p>\n

\u60a8\u53ea\u9700\u67e5\u770b\u7aef\u53e3\u6570\u636e\u4fbf\u53ef\u8f7b\u677e\u4e86\u89e3\u670d\u52a1\u60c5\u51b5\u3002\u4ee5\u4e0b\u8fd9\u5219\u5c0f\u7a8d\u95e8\u5c06\u534f\u52a9\u60a8\u5feb\u901f\u9501\u5b9a\u611f\u5174\u8da3\u7684\u670d\u52a1\u6240\u5bf9\u5e94\u7684\u7aef\u53e3\u54e6~<\/p>\n

netstat -tlnp | grep <service_name><\/p>\n

\u5c0a\u656c\u7684\u5ba2\u6237\u670b\u53cb\uff0c\u6211\u4eec\u7279\u610f\u4e3a\u60a8\u6574\u7406\u4e86Linux\u7cfb\u7edf\u5b9e\u7528\u7684\u670d\u52a1\u68c0\u67e5\u653b\u7565\uff0c\u76f8\u4fe1\u4f1a\u7ed9\u60a8\u5e26\u6765\u4e00\u4e9b\u5e2e\u52a9\u3002\u5c0a\u91cd\u60a8\u7684\u9009\u62e9\uff0c\u60a8\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u9700\u6c42\u6311\u9009\u5408\u9002\u7684\u65b9\u5f0f\u8fdb\u884c\u670d\u52a1\u72b6\u6001\u67e5\u8be2\u3002\u5982\u6709\u4efb\u4f55\u7591\u8651\u6216\u8005\u60f3\u6cd5\uff0c\u975e\u5e38\u671f\u5f85\u542c\u5230\u60a8\u7684\u58f0\u97f3\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"

\u5728\u5b66\u4e60\u5982\u4f55\u719f\u7ec3\u4f7f\u7528Linux\u64cd\u4f5c\u7cfb\u7edf\u65f6\uff0c\u8bf7\u8f7b\u677e\u638c\u63e1\u8fd9\u4e9b\u5b9e\u7528\u6280\u5de7\uff0c\u4e86\u89e3\u60a8\u6b63\u5728\u8fd0\u884c\u7684\u6240\u6709\u670d\u52a1\u4fe1\u606f\uff0c\u4ee5\u4fbf\u66f4\u9ad8\u6548\u5730\u8fdb\u884c\u7cfb\u7edf\u7ba1\u7406\u4e0e\u4fdd\u517b\u3002\u4ee5\u4e0b\u7ed9\u60a8\u5e26\u676510\u6761\u7b80\u660e\u4e14\u6613\u5b9e\u73b0\u7684\u67e5\u770bLinux\u670d\u52a1\u77e5\u8bc6\u3002\u672c\u516c\u53f8\u8bbe\u6709\u4fbf\u6377\u5b9e\u7528\u7684\u670d\u52a1\u547d\u4ee4\uff0c\u53ef\u52a9\u60a8\u8fc5\u901f\u638c\u63e1\u76ee\u524d\u8fd0\u884c\u4e2d\u7684\u5168\u90e8\u670d\u52a1\u3002<\/p>\n","protected":false},"author":1,"featured_media":289030,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-289029","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/289029","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=289029"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/289029\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/289030"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=289029"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=289029"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=289029"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}