{"id":26469,"date":"2022-01-19T02:58:27","date_gmt":"2022-01-18T18:58:27","guid":{"rendered":"http:\/\/www.idc.net\/help\/26469\/"},"modified":"2022-01-19T02:58:27","modified_gmt":"2022-01-18T18:58:27","slug":"%e9%80%9a%e8%bf%87systemctl%e5%88%97%e5%87%ba%e5%90%af%e5%8a%a8%e5%a4%b1%e8%b4%a5%e7%9a%84%e6%9c%8d%e5%8a%a1","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/26469\/","title":{"rendered":"\u901a\u8fc7systemctl\u5217\u51fa\u542f\u52a8\u5931\u8d25\u7684\u670d\u52a1"},"content":{"rendered":"<div class=\"idc_table\">\n<p style=\"padding-top: 8px;padding-bottom: 8px;line-height: 1.75;margin: 0.8em 0;font-size: 16px;color: #353535\">Linux \u670d\u52a1\u7ba1\u7406\u4e24\u79cd\u65b9\u5f0fservice\u548csystemctl<\/p>\n<p style=\"padding-top: 8px;padding-bottom: 8px;line-height: 1.75;margin: 0.8em 0;font-size: 16px;color: #353535\">systemd\u662fLinux\u7cfb\u7edf\u6700\u65b0\u7684\u521d\u59cb\u5316\u7cfb\u7edf(init),\u4f5c\u7528\u662f\u63d0\u9ad8\u7cfb\u7edf\u7684\u542f\u52a8\u901f\u5ea6\uff0c\u5c3d\u53ef\u80fd\u542f\u52a8\u8f83\u5c11\u7684\u8fdb\u7a0b\uff0c\u5c3d\u53ef\u80fd\u66f4\u591a\u8fdb\u7a0b\u5e76\u53d1\u542f\u52a8\u3002<\/p>\n<p style=\"padding-top: 8px;padding-bottom: 8px;line-height: 1.75;margin: 0.8em 0;font-size: 16px;color: #353535\">systemd\u5bf9\u5e94\u7684\u8fdb\u7a0b\u7ba1\u7406\u547d\u4ee4\u662fsystemctl<\/p>\n<h2><span style=\"font-size: 18px;font-weight: bold;color: #222;padding-left: 10px;border-left: 5px solid #f83929\">\u5217\u51fa\u542f\u52a8\u5931\u8d25\u7684\u670d\u52a1<\/span><\/h2>\n<pre><code>[root@localhost&nbsp;~]<span style=\"color: #998;font-style: italic;line-height: 26px\">#&nbsp;systemctl&nbsp;list-units&nbsp;--state&nbsp;failed<\/span>\r\n&nbsp;UNIT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LOAD&nbsp;&nbsp;&nbsp;ACTIVE&nbsp;SUB&nbsp;&nbsp;&nbsp;&nbsp;DESCRIPTION\r\n\u25cf&nbsp;httpd.service&nbsp;loaded&nbsp;failed&nbsp;failed&nbsp;The&nbsp;Apache&nbsp;HTTP&nbsp;Server\r\n\r\nLOAD&nbsp;&nbsp;&nbsp;=&nbsp;Reflects&nbsp;whether&nbsp;the&nbsp;unit&nbsp;definition&nbsp;was&nbsp;properly&nbsp;loaded.\r\nACTIVE&nbsp;=&nbsp;The&nbsp;high-level&nbsp;unit&nbsp;activation&nbsp;state,&nbsp;i.e.&nbsp;generalization&nbsp;of&nbsp;SUB.\r\nSUB&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;The&nbsp;low-level&nbsp;unit&nbsp;activation&nbsp;state,&nbsp;values&nbsp;depend&nbsp;on&nbsp;unit&nbsp;<span style=\"color: #0086b3;line-height: 26px\">type<\/span>.\r\n\r\n1&nbsp;loaded&nbsp;units&nbsp;listed.&nbsp;Pass&nbsp;--all&nbsp;to&nbsp;see&nbsp;loaded&nbsp;but&nbsp;inactive&nbsp;units,&nbsp;too.\r\nTo&nbsp;show&nbsp;all&nbsp;installed&nbsp;unit&nbsp;files&nbsp;use&nbsp;<span style=\"color: #d14;line-height: 26px\">'systemctl&nbsp;list-unit-files'<\/span>.\r\n<\/code><\/pre>\n<p style=\"padding-top: 8px;padding-bottom: 8px;line-height: 1.75;margin: 0.8em 0;font-size: 16px;color: #353535\"><img decoding=\"async\" style=\"border-radius: 6px;margin: 20px auto;max-width: 95%\" src=\"https:\/\/lxlinux.superbed.verylink.top\/item\/621b7f732ab3f51d9124c55b.png\" class=\"aligncenter\"> \u53ef\u4ee5\u53d1\u73b0\uff0c\u6709\u4e2a\u4e00\u4e2a\u670d\u52a1\u542f\u52a8\u5931\u8d25\u4e86\u3002<\/p>\n<h2><span style=\"font-size: 18px;font-weight: bold;color: #222;padding-left: 10px;border-left: 5px solid #f83929\">is-failed\u9009\u9879<\/span><\/h2>\n<p style=\"padding-top: 8px;padding-bottom: 8px;line-height: 1.75;margin: 0.8em 0;font-size: 16px;color: #353535\">\u53ef\u4ee5\u4f7f\u7528<code>is-failed<\/code>\u9009\u9879\u68c0\u67e5\u6307\u5b9a\u7684\u670d\u52a1\u662f\u5426\u542f\u52a8\u5931\u8d25\u3002\u5982\u679c\u542f\u52a8\u5931\u8d25\uff0c\u7ed3\u679c\u662f<code>failed<\/code>\u3002\u5982\u679c\u542f\u52a8\u6ca1\u6709\u95ee\u9898\uff0c\u7ed3\u679c\u662f<code>active<\/code>\u3002<\/p>\n<pre><code>[root@localhost&nbsp;~]<span style=\"color: #998;font-style: italic;line-height: 26px\">#&nbsp;systemctl&nbsp;is-failed&nbsp;httpd<\/span>\r\nfailed\r\n[root@localhost&nbsp;~]<span style=\"color: #998;font-style: italic;line-height: 26px\">#&nbsp;systemctl&nbsp;is-failed&nbsp;vsftpd<\/span>\r\nactive\r\n<\/code><\/pre>\n<p><img decoding=\"async\" style=\"border-radius: 6px;margin: 20px auto;max-width: 95%\" src=\"https:\/\/lxlinux.superbed.verylink.top\/item\/621b7f732ab3f51d9124c635.png\" class=\"aligncenter\">  <\/p>\n<h2><span style=\"font-size: 18px;font-weight: bold;color: #222;padding-left: 10px;border-left: 5px solid #f83929\">\u68c0\u67e5\u670d\u52a1\u7684\u72b6\u6001<\/span><\/h2>\n<p style=\"padding-top: 8px;padding-bottom: 8px;line-height: 1.75;margin: 0.8em 0;font-size: 16px;color: #353535\">\u53ef\u4ee5\u4f7f\u7528<code>status<\/code>\u9009\u9879\uff0c\u67e5\u770b\u670d\u52a1\u542f\u52a8\u5931\u8d25\u7684\u539f\u56e0\uff0c\u4e0b\u9762\u72b6\u6001\u4fe1\u606f\u91cc\u9762\u544a\u8bc9\u6211\u4eec\uff0c\u662f<code>httpd.conf<\/code>\u914d\u7f6e\u6587\u4ef6354\u884c\u6709\u8bed\u6cd5\u9519\u8bef\u3002<\/p>\n<pre><code>May&nbsp;26&nbsp;09:22:05&nbsp;localhost&nbsp;httpd[2958]:&nbsp;httpd:&nbsp;Syntax&nbsp;error&nbsp;on&nbsp;line&nbsp;354&nbsp;of&nbsp;\/etc\/httpd\/conf\/httpd.conf:&nbsp;\/...osed.\r\n[root@localhost&nbsp;~]<span style=\"color: #998;font-style: italic;line-height: 26px\">#&nbsp;systemctl&nbsp;status&nbsp;httpd<\/span>\r\n\u25cf&nbsp;httpd.service&nbsp;-&nbsp;The&nbsp;Apache&nbsp;HTTP&nbsp;Server\r\n&nbsp;&nbsp;Loaded:&nbsp;loaded&nbsp;(\/usr\/lib\/systemd\/system\/httpd.service;&nbsp;disabled;&nbsp;vendor&nbsp;preset:&nbsp;disabled)\r\n&nbsp;&nbsp;Active:&nbsp;failed&nbsp;(Result:&nbsp;<span style=\"color: #0086b3;line-height: 26px\">exit<\/span>-code)&nbsp;since&nbsp;Tue&nbsp;2020-05-26&nbsp;09:22:05&nbsp;CST;&nbsp;18min&nbsp;ago\r\n&nbsp;&nbsp;&nbsp;&nbsp;Docs:&nbsp;man:httpd(8)\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;man:apachectl(8)\r\nMain&nbsp;PID:&nbsp;2958&nbsp;(code=exited,&nbsp;status=1\/FAILURE)\r\n\r\nMay&nbsp;26&nbsp;09:22:05&nbsp;localhost&nbsp;systemd[1]:&nbsp;Starting&nbsp;The&nbsp;Apache&nbsp;HTTP&nbsp;Server...\r\nMay&nbsp;26&nbsp;09:22:05&nbsp;localhost&nbsp;httpd[2958]:&nbsp;httpd:&nbsp;Syntax&nbsp;error&nbsp;on&nbsp;line&nbsp;354&nbsp;of&nbsp;\/etc\/httpd\/conf\/httpd.conf:&nbsp;\/...osed.\r\nMay&nbsp;26&nbsp;09:22:05&nbsp;localhost&nbsp;systemd[1]:&nbsp;httpd.service:&nbsp;main&nbsp;process&nbsp;exited,&nbsp;code=exited,&nbsp;status=1\/FAILURE\r\nMay&nbsp;26&nbsp;09:22:05&nbsp;localhost&nbsp;<span style=\"color: #0086b3;line-height: 26px\">kill<\/span>[2959]:&nbsp;<span style=\"color: #0086b3;line-height: 26px\">kill<\/span>:&nbsp;cannot&nbsp;find&nbsp;process&nbsp;<span style=\"color: #d14;line-height: 26px\">\"\"<\/span>\r\nMay&nbsp;26&nbsp;09:22:05&nbsp;localhost&nbsp;systemd[1]:&nbsp;httpd.service:&nbsp;control&nbsp;process&nbsp;exited,&nbsp;code=exited&nbsp;status=1\r\nMay&nbsp;26&nbsp;09:22:05&nbsp;localhost&nbsp;systemd[1]:&nbsp;Failed&nbsp;to&nbsp;start&nbsp;The&nbsp;Apache&nbsp;HTTP&nbsp;Server.\r\nMay&nbsp;26&nbsp;09:22:05&nbsp;localhost&nbsp;systemd[1]:&nbsp;Unit&nbsp;httpd.service&nbsp;entered&nbsp;failed&nbsp;state.\r\nMay&nbsp;26&nbsp;09:22:05&nbsp;localhost&nbsp;systemd[1]:&nbsp;httpd.service&nbsp;failed.\r\nHint:&nbsp;Some&nbsp;lines&nbsp;were&nbsp;ellipsized,&nbsp;use&nbsp;-l&nbsp;to&nbsp;show&nbsp;<span style=\"color: #333;font-weight: bold;line-height: 26px\">in<\/span>&nbsp;full.\r\n<\/code><\/pre>\n<p><img decoding=\"async\" style=\"border-radius: 6px;margin: 20px auto;max-width: 95%\" src=\"https:\/\/lxlinux.superbed.verylink.top\/item\/621b7f732ab3f51d9124c5f5.png\" class=\"aligncenter\">  CentOS7\u4e2d\u4f7f\u7528systemctl\u5217\u51fa\u542f\u52a8\u5931\u8d25\u7684\u670d\u52a1CentOS7\u4e2d\u4f7f\u7528systemctl\u5217\u51fa\u542f\u52a8\u5931\u8d25\u7684\u670d\u52a1   <\/p>\n<h2><span style=\"font-size: 18px;font-weight: bold;color: #222;padding-left: 10px;border-left: 5px solid #f83929\">\u4f7f\u7528journalctl\u67e5\u770b\u670d\u52a1\u7684\u542f\u52a8\u65e5\u5fd7<\/span><\/h2>\n<p style=\"padding-top: 8px;padding-bottom: 8px;line-height: 1.75;margin: 0.8em 0;font-size: 16px;color: #353535\">\u5982\u679c\u4f7f\u7528<code>systemctl status [unit]<\/code>\u6ca1\u6709\u627e\u5230\u670d\u52a1\u542f\u52a8\u5931\u8d25\u7684\u539f\u56e0\uff0c\u53ef\u4ee5\u4f7f\u7528journalctl\u67e5\u770b\u66f4\u591a\u7684\u542f\u52a8\u65e5\u5fd7\u3002<\/p>\n<p style=\"padding-top: 8px;padding-bottom: 8px;line-height: 1.75;margin: 0.8em 0;font-size: 16px;color: #353535\">\u4e0b\u9762\u64cd\u4f5c\u662f\u8fc7\u6ee4\u51fa\u6240\u6709\u5e26\u6709<code>error<\/code>\u7684\u884c\uff0c\u53ef\u4ee5\u627e\u5230\u542f\u52a8\u5931\u8d25\u7684\u670d\u52a1\u3002<\/p>\n<pre><code>[root@localhost&nbsp;~]<span style=\"color: #998;font-style: italic;line-height: 26px\">#&nbsp;journalctl&nbsp;|grep&nbsp;'error'<\/span>\r\nMay&nbsp;26&nbsp;09:22:05&nbsp;localhost&nbsp;httpd[2958]:&nbsp;httpd:&nbsp;Syntax&nbsp;error&nbsp;on&nbsp;line&nbsp;354&nbsp;of&nbsp;\/etc\/httpd\/conf\/httpd.conf:&nbsp;\/etc\/httpd\/conf\/httpd.conf:354:&nbsp;&nbsp;was&nbsp;not&nbsp;closed.\r\n<\/code><\/pre>\n<p style=\"padding-top: 8px;padding-bottom: 8px;line-height: 1.75;margin: 0.8em 0;font-size: 16px;color: #353535\"><img decoding=\"async\" style=\"border-radius: 6px;margin: 20px auto;max-width: 95%\" src=\"https:\/\/lxlinux.superbed.verylink.top\/item\/621b7f722ab3f51d9124c41d.png\" class=\"aligncenter\"> \u4e5f\u53ef\u4ee5\u4f7f\u7528<code>journalctl -u [unit]<\/code>\u53ea\u67e5\u770b\u67d0\u4e00\u4e2a\u670d\u52a1\u7684\u542f\u52a8\u65e5\u5fd7\uff1a<\/p>\n<pre><code>[root@localhost&nbsp;~]<span style=\"color: #998;font-style: italic;line-height: 26px\">#&nbsp;journalctl&nbsp;-u&nbsp;httpd.service<\/span>\r\n--&nbsp;Logs&nbsp;begin&nbsp;at&nbsp;Sun&nbsp;2020-05-24&nbsp;06:52:52&nbsp;CST,&nbsp;end&nbsp;at&nbsp;Tue&nbsp;2020-05-26&nbsp;09:48:03&nbsp;CST.&nbsp;--\r\nMay&nbsp;26&nbsp;09:22:05&nbsp;localhost&nbsp;systemd[1]:&nbsp;Starting&nbsp;The&nbsp;Apache&nbsp;HTTP&nbsp;Server...\r\nMay&nbsp;26&nbsp;09:22:05&nbsp;localhost&nbsp;httpd[2958]:&nbsp;httpd:&nbsp;Syntax&nbsp;error&nbsp;on&nbsp;line&nbsp;354&nbsp;of&nbsp;\/etc\/httpd\/conf\/httpd.conf:&nbsp;\/etc\/httpd\/conf\/httpd.conf:354:&nbsp;&nbsp;was&nbsp;not&nbsp;closed.\r\nMay&nbsp;26&nbsp;09:22:05&nbsp;localhost&nbsp;systemd[1]:&nbsp;httpd.service:&nbsp;main&nbsp;process&nbsp;exited,&nbsp;code=exited,&nbsp;status=1\/FAILURE\r\nMay&nbsp;26&nbsp;09:22:05&nbsp;localhost&nbsp;<span style=\"color: #0086b3;line-height: 26px\">kill<\/span>[2959]:&nbsp;<span style=\"color: #0086b3;line-height: 26px\">kill<\/span>:&nbsp;cannot&nbsp;find&nbsp;process&nbsp;<span style=\"color: #d14;line-height: 26px\">\"\"<\/span>\r\nMay&nbsp;26&nbsp;09:22:05&nbsp;localhost&nbsp;systemd[1]:&nbsp;httpd.service:&nbsp;control&nbsp;process&nbsp;exited,&nbsp;code=exited&nbsp;status=1\r\nMay&nbsp;26&nbsp;09:22:05&nbsp;localhost&nbsp;systemd[1]:&nbsp;Failed&nbsp;to&nbsp;start&nbsp;The&nbsp;Apache&nbsp;HTTP&nbsp;Server.\r\nMay&nbsp;26&nbsp;09:22:05&nbsp;localhost&nbsp;systemd[1]:&nbsp;Unit&nbsp;httpd.service&nbsp;entered&nbsp;failed&nbsp;state.\r\nMay&nbsp;26&nbsp;09:22:05&nbsp;localhost&nbsp;systemd[1]:&nbsp;httpd.service&nbsp;failed.\r\n\r\n<span style=\"color: #998;font-style: italic;line-height: 26px\">#\u8fc7\u6ee4\u51fa\u6709\u9519\u8bef\u7684\u4fe1\u606f\u3002<\/span>\r\n[root@localhost&nbsp;~]<span style=\"color: #998;font-style: italic;line-height: 26px\">#&nbsp;journalctl&nbsp;-u&nbsp;httpd.service&nbsp;|grep&nbsp;'error'<\/span>\r\nMay&nbsp;26&nbsp;09:22:05&nbsp;localhost&nbsp;httpd[2958]:&nbsp;httpd:&nbsp;Syntax&nbsp;error&nbsp;on&nbsp;line&nbsp;354&nbsp;of&nbsp;\/etc\/httpd\/conf\/httpd.conf:&nbsp;\/etc\/httpd\/conf\/httpd.conf:354:&nbsp;&nbsp;was&nbsp;not&nbsp;closed.\r\n<\/code><\/pre>\n<p style=\"padding-top: 8px;padding-bottom: 8px;line-height: 1.75;margin: 0.8em 0;font-size: 16px;color: #353535\"><img decoding=\"async\" style=\"border-radius: 6px;margin: 20px auto;max-width: 95%\" src=\"https:\/\/lxlinux.superbed.verylink.top\/item\/621b7f722ab3f51d9124c483.png\" class=\"aligncenter\"> \u53d1\u73b0<code>\/etc\/httpd\/conf\/httpd.conf<\/code>\u914d\u7f6e\u6587\u4ef6\u7684354\u884c\uff0c<code>Directory<\/code>\u6807\u7b7e\u6ca1\u6709\u5173\u95ed\uff0c\u8fd4\u73b0\u539f\u56e0\u4e86\uff0c\u5c31\u9a6c\u4e0a\u4fee\u6539\u5427\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux \u670d\u52a1\u7ba1\u7406\u4e24\u79cd\u65b9\u5f0fservice\u548csystemctl systemd\u662fLinux\u7cfb\u7edf\u6700\u65b0\u7684\u521d\u59cb\u5316\u7cfb\u7edf [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":26470,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[],"class_list":["post-26469","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/26469","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=26469"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/26469\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media\/26470"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=26469"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=26469"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=26469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}