{"id":17993,"date":"2024-11-18T08:22:56","date_gmt":"2024-11-18T00:22:56","guid":{"rendered":"https:\/\/fwq.ai\/blog\/17993\/"},"modified":"2024-11-18T08:22:56","modified_gmt":"2024-11-18T00:22:56","slug":"linux%e5%85%b3%e6%9c%ba%e5%91%bd%e4%bb%a4init-0%e8%bf%87%e6%97%b6%e4%ba%86%e5%90%97","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/17993\/","title":{"rendered":"linux\u5173\u673a\u547d\u4ee4init 0\u8fc7\u65f6\u4e86\u5417"},"content":{"rendered":"<blockquote><p>\n  linux \u5173\u673a\u547d\u4ee4 init 0 \u5df2\u8fc7\u65f6\uff0c\u53d6\u800c\u4ee3\u4e4b\u7684\u662f systemd \u5b88\u62a4\u8fdb\u7a0b\uff0c\u56e0\u4e3a\u5b83\u63d0\u4f9b\u4e86\u66f4\u4e3a\u73b0\u4ee3\u5316\u7684\u5173\u673a\u8fc7\u7a0b\uff0c\u5305\u62ec\u4f9d\u8d56\u5173\u7cfb\u7ba1\u7406\u3001\u65e5\u5fd7\u8bb0\u5f55\u3001\u66f4\u5b89\u5168\u7684\u5173\u673a\u64cd\u4f5c\u548c\u7edf\u4e00\u7684\u5173\u673a\u754c\u9762\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/22\/2024052206302688031.jpg\" class=\"aligncenter\" title=\"linux\u5173\u673a\u547d\u4ee4init 0\u8fc7\u65f6\u4e86\u5417\u63d2\u56fe\" alt=\"linux\u5173\u673a\u547d\u4ee4init 0\u8fc7\u65f6\u4e86\u5417\u63d2\u56fe\" \/><\/p>\n<p><strong>Linux \u5173\u673a\u547d\u4ee4 init 0 \u5df2\u8fc7\u65f6<\/strong><\/p>\n<p>\u968f\u7740 Linux \u5185\u6838\u7684\u53d1\u5c55\u548c Systemd \u5b88\u62a4\u8fdb\u7a0b\u7684\u666e\u53ca\uff0cinit 0 \u547d\u4ee4\u5df2\u9010\u6e10\u88ab\u8ba4\u4e3a\u8fc7\u65f6\u3002\u4ee5\u4e0b\u662f\u5b83\u7684\u8fc7\u65f6\u539f\u56e0\uff1a<\/p>\n<p><strong>1. Systemd \u7684\u5e7f\u6cdb\u91c7\u7528<\/strong><\/p>\n<p>Systemd \u662f\u4e00\u4e2a\u73b0\u4ee3\u5316\u7684\u7cfb\u7edf\u548c\u670d\u52a1\u7ba1\u7406\u5668\uff0c\u5b83\u53d6\u4ee3\u4e86\u4f20\u7edf\u7684 init \u7cfb\u7edf\uff0c\u5305\u62ec init 0 \u547d\u4ee4\u3002Systemd \u63d0\u4f9b\u4e86\u66f4\u9ad8\u7ea7\u7684\u529f\u80fd\uff0c\u4f8b\u5982\u4f9d\u8d56\u5173\u7cfb\u7ba1\u7406\u3001\u65e5\u5fd7\u8bb0\u5f55\u548c\u6545\u969c\u76d1\u63a7\u3002<\/p>\n<p><strong>2. \u66f4\u5b89\u5168\u548c\u7a33\u5b9a\u7684\u5173\u673a\u8fc7\u7a0b<\/strong><\/p>\n<p>init 0 \u547d\u4ee4\u76f4\u63a5\u5173\u95ed\u7cfb\u7edf\uff0c\u8fd9\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6216\u7cfb\u7edf\u635f\u574f\u3002Systemd \u91c7\u7528\u4e86\u66f4\u5b89\u5168\u548c\u7a33\u5b9a\u7684\u5173\u673a\u8fc7\u7a0b\uff0c\u5b83\u4f1a\u5148\u505c\u6b62\u6240\u6709\u670d\u52a1\uff0c\u7136\u540e\u624d\u5173\u95ed\u7cfb\u7edf\u3002<\/p>\n<p><strong>3. \u7edf\u4e00\u7684\u5173\u673a\u754c\u9762<\/strong><\/p>\n<p>Systemd \u63d0\u4f9b\u4e86\u4e00\u4e2a\u7edf\u4e00\u7684\u5173\u673a\u754c\u9762\uff0c\u5141\u8bb8\u7528\u6237\u4f7f\u7528\u591a\u79cd\u547d\u4ee4\u5173\u95ed\u7cfb\u7edf\u3002\u8fd9\u4e9b\u547d\u4ee4\u5305\u62ec systemctl poweroff\u3001systemctl halt \u548c systemctl reboot\u3002<\/p>\n<p><strong>4. \u63a5\u53d7\u4fe1\u53f7\u7684\u66ff\u4ee3\u65b9\u6848<\/strong><\/p>\n<p>init 0 \u547d\u4ee4\u63a5\u53d7 SIGINT \u548c SIGTERM \u4fe1\u53f7\u6765\u5173\u95ed\u7cfb\u7edf\u3002\u7136\u800c\uff0cSystemd \u63d0\u4f9b\u4e86\u66f4\u5f3a\u5927\u7684\u66ff\u4ee3\u65b9\u6848\uff0c\u4f8b\u5982 shutdown \u547d\u4ee4\uff0c\u5b83\u5141\u8bb8\u7528\u6237\u6307\u5b9a\u5173\u95ed\u7684\u65f6\u95f4\u3001\u6d88\u606f\u548c\u5176\u4ed6\u9009\u9879\u3002<\/p>\n<p>\u56e0\u6b64\uff0c\u5728\u5f53\u4eca\u7684 Linux \u7cfb\u7edf\u4e2d\uff0c\u4e0d\u5efa\u8bae\u518d\u4f7f\u7528 init 0 \u547d\u4ee4\u3002\u53d6\u800c\u4ee3\u4e4b\u7684\u662f\uff0c\u7528\u6237\u5e94\u8be5\u4f7f\u7528 Systemd \u63d0\u4f9b\u7684\u73b0\u4ee3\u5316\u5173\u673a\u547d\u4ee4\uff0c\u4f8b\u5982 systemctl poweroff\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5173\u673a\u547d\u4ee4init 0\u8fc7\u65f6\u4e86\u5417\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>linux \u5173\u673a\u547d\u4ee4 init 0 \u5df2\u8fc7\u65f6\uff0c\u53d6\u800c\u4ee3\u4e4b\u7684\u662f systemd \u5b88\u62a4\u8fdb\u7a0b\uff0c\u56e0\u4e3a\u5b83\u63d0\u4f9b\u4e86\u66f4\u4e3a\u73b0\u4ee3\u5316\u7684\u5173\u673a\u8fc7\u7a0b\uff0c\u5305\u62ec\u4f9d\u8d56\u5173\u7cfb\u7ba1\u7406\u3001\u65e5\u5fd7\u8bb0\u5f55\u3001\u66f4\u5b89\u5168\u7684\u5173\u673a\u64cd\u4f5c\u548c\u7edf\u4e00\u7684\u5173\u673a\u754c\u9762\u3002 Linux \u5173\u673a\u547d\u4ee4 init 0 \u5df2\u8fc7\u65f6 \u968f\u7740 Linux \u5185\u6838\u7684\u53d1\u5c55\u548c Systemd \u5b88\u62a4\u8fdb\u7a0b\u7684\u666e\u53ca\uff0cinit 0 \u547d\u4ee4\u5df2\u9010\u6e10\u88ab\u8ba4\u4e3a\u8fc7\u65f6\u3002\u4ee5\u4e0b\u662f\u5b83\u7684\u8fc7\u65f6\u539f\u56e0\uff1a 1. Systemd \u7684\u5e7f\u6cdb\u91c7\u7528 Systemd \u662f\u4e00\u4e2a\u73b0\u4ee3\u5316\u7684\u7cfb\u7edf\u548c\u670d\u52a1\u7ba1\u7406\u5668\uff0c\u5b83\u53d6\u4ee3\u4e86\u4f20\u7edf\u7684 init \u7cfb\u7edf\uff0c\u5305\u62ec init 0 \u547d\u4ee4\u3002Systemd \u63d0\u4f9b\u4e86\u66f4\u9ad8\u7ea7\u7684\u529f\u80fd\uff0c\u4f8b\u5982\u4f9d\u8d56\u5173\u7cfb\u7ba1\u7406\u3001\u65e5\u5fd7\u8bb0\u5f55\u548c\u6545\u969c\u76d1\u63a7\u3002 2. \u66f4\u5b89\u5168\u548c\u7a33\u5b9a\u7684\u5173\u673a\u8fc7\u7a0b init 0 \u547d\u4ee4\u76f4\u63a5\u5173\u95ed\u7cfb\u7edf\uff0c\u8fd9\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6216\u7cfb\u7edf\u635f\u574f\u3002Systemd \u91c7\u7528\u4e86\u66f4\u5b89\u5168\u548c\u7a33\u5b9a\u7684\u5173\u673a\u8fc7\u7a0b\uff0c\u5b83\u4f1a\u5148\u505c\u6b62\u6240\u6709\u670d\u52a1\uff0c\u7136\u540e\u624d\u5173\u95ed\u7cfb\u7edf\u3002 3. \u7edf\u4e00\u7684\u5173\u673a\u754c\u9762 Systemd \u63d0\u4f9b\u4e86\u4e00\u4e2a\u7edf\u4e00\u7684\u5173\u673a\u754c\u9762\uff0c\u5141\u8bb8\u7528\u6237\u4f7f\u7528\u591a\u79cd\u547d\u4ee4\u5173\u95ed\u7cfb\u7edf\u3002\u8fd9\u4e9b\u547d\u4ee4\u5305\u62ec systemctl poweroff\u3001systemctl halt \u548c systemctl reboot\u3002 4. \u63a5\u53d7\u4fe1\u53f7\u7684\u66ff\u4ee3\u65b9\u6848 init 0 \u547d\u4ee4\u63a5\u53d7 SIGINT \u548c SIGTERM \u4fe1\u53f7\u6765\u5173\u95ed\u7cfb\u7edf\u3002\u7136\u800c\uff0cSystemd [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-17993","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/17993","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=17993"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/17993\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=17993"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=17993"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=17993"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}