linux\u7cfb\u7edf\u5173\u673a\u547d\u4ee4<\/strong>linux vi \u547d\u4ee4\uff0c\u53ef\u4ee5\u7528shutdown-c\u547d\u4ee4\u53d6\u6d88\u91cd\u542f<\/p>\n1.shutdown<\/p>\n
shutdown\u547d\u4ee4\u5b89\u5168\u5730\u5c06\u7cfb\u7edf\u6b7b\u673a\u3002\u6709\u4e9b\u7528\u6237\u4f1a\u4f7f\u7528\u76f4\u63a5\u65ad\u5f00\u7535\u6e90\u7684\u65b9\u6cd5\u6765\u5173\u6389linux\uff0c<\/p>\n
\u8fd9\u662f\u975e\u5e38\u5371\u9669\u7684\u3002\u7531\u4e8elinux\u4e0ewindows\u4e0d\u540c\uff0c\u5176\u540e\u53f0\u8fd0\u884c\u7740\u8bb8\u591a\u8fdb\u7a0b\uff0c\u6240\u4ee5\u5f3a\u5236\u6b7b\u673a\u53ef\u80fd<\/p>\n
\u4f1a\u9020\u6210\u8fdb\u7a0b\u7684\u6570\u636e\u9057\u5931\ufe50\u4f7f\u7cfb\u7edf\u5904\u4e8e\u4e0d\u7a33\u5b9a\u7684\u72b6\u6001\ufe50\u751a\u81f3\u5728\u6709\u7684\u7cfb\u7edf\u4e2d\u4f1a\u6bc1\u574f\u786c\u4ef6\u8bbe\u5907\u3002<\/p>\n
<\/p>\n
\u800c\u5728\u7cfb\u7edf\u6b7b\u673a\u524d\u4f7f\u7528shutdown\u547d\u4ee4\ufe50\u7cfb\u7edf\u7ba1\u7406\u5458\u4f1a\u901a\u77e5\u6240\u6709\u767b\u9646\u7684\u7528\u6237\u7cfb\u7edf\u5373\u5c06\u5173\u6389\u3002<\/p>\n
\u4f46\u662flogin\u6307\u4ee4\u4f1a\u88ab\u51bb\u7ed3\ufe50\u5373\u65b0\u7684\u7528\u6237\u4e0d\u80fd\u518d\u767b\u5165\u3002\u76f4\u63a5\u6b7b\u673a\u6216\u5219\u5ef6\u540e\u4e00\u5b9a\u7684\u65f6\u95f4\u624d\u6b7b\u673a<\/p>\n
\u90fd\u662f\u53ef\u80fd\u7684\ufe50\u8fd8\u53ef\u80fd\u91cd\u542f\u3002\u8fd9\u662f\u7531\u6240\u6709\u8fdb\u7a0b\u3014process\u3015\u90fd\u4f1a\u6536\u5230\u7cfb\u7edf\u6240\u9001\u8fbe\u7684\u8baf\u53f7\u3014signal\u3015<\/p>\n
\u51b3\u5b9a\u7684\u3002\u8fd9\u8ba9\u50cfvi\u4e4b\u7c7b\u7684\u7a0b\u5e8f\u6709\u65f6\u95f4\u5b58\u50a8\u76ee\u524d\u6b63\u5728\u7f16\u8f91\u7684\u6587\u6863\ufe50\u800c\u50cf\u5904\u7406\u7535\u90ae\u3014mail\u3015\u548c<\/p>\n
\u65b0\u95fb\u3014news\u3015\u7684\u7a0b\u5e8f\u5219\u53ef\u4ee5\u6b63\u5e38\u5730\u79bb\u5f00\u7b49\u7b49\u3002<\/p>\n
shutdown\u6267\u884c\u5b83\u7684\u5de5\u4f5c\u662f\u9001\u8baf\u53f7\u3014signal\u3015\u7ed9init\u7a0b\u5e8f\ufe50\u8981\u6c42\u5b83\u6539\u53d8runlevel\u3002<\/p>\n
Runlevel0\u88ab\u62ff\u6765\u505c\u673a\u3014halt\u3015\ufe50runlevel6\u662f\u62ff\u6765\u91cd\u65b0\u6fc0\u6d3b\u3014reboot\u3015\u7cfb\u7edf\ufe50<\/p>\n
\u800crunlevel1\u5219\u662f\u88ab\u62ff\u6765\u8ba9\u7cfb\u7edf\u6b65\u5165\u7ba1\u7406\u5de5\u4f5c\u53ef\u4ee5\u8fdb\u884c\u7684\u72b6\u6001\ufe54\u8fd9\u662f\u9884\u8bbe\u7684\ufe50\u5047\u8bbe\u6ca1\u6709-h\u4e5f<\/p>\n
\u6ca1\u6709-r\u53c2\u6570\u7ed9shutdown\u3002\u8981\u60f3\u4e86\u89e3\u5728\u505c\u673a\u3014halt\u3015\u6216\u8005\u91cd\u65b0\u5f00\u673a\u3014reboot\u3015\u8fc7\u7a0b\u4e2d\u505a\u4e86\u4ec0\u4e48<\/p>\n
<\/p>\n
\u52a8\u4f5c\ufe50\u4f60\u53ef\u4ee5\u5728\u8fd9\u4e2a\u6587\u4ef6\/etc\/inittab\u91cc\u770b\u89c1\u90a3\u4e9brunlevels\u76f8\u5173\u7684\u8d44\u6599\u3002<\/p>\n
shutdown\u53c2\u6570\u8bf4\u660e:<\/p>\n
[-t]\u5728\u6539\u53d8\u5230\u5176\u5b83runlevel\u4e4b\u524d\ufe50\u544a\u8bc9init\u591a\u4e45\u4e4b\u540e\u6b7b\u673a\u3002<\/p>\n
[-r]\u91cd\u542f\u4f30\u7b97\u5668\u3002<\/p>\n
[-k]\u5e76\u4e0d\u771f\u6b63\u6b7b\u673a\ufe50\u53ea\u662f\u9001\u8b66\u544a\u8baf\u53f7\u7ed9\u6bcf\u4e2a\u767b\u9646\u8005\u3014login\u3015\u3002<\/p>\n
[-h]\u6b7b\u673a\u540e\u5173\u6389\u7535\u6e90\u3014halt\u3015\u3002<\/p>\n
[-n]\u4e0d\u7528init\ufe50\u800c\u662f\u81ea\u5df1\u6765\u6b7b\u673a\u3002\u4e0d\u9f13\u52b1\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\ufe50\u5e76\u4e14\u8be5\u9009\u9879\u6240\u5f62\u6210\u7684\u540e\u679c\u5f80<\/p>\n
\u5f80\u4e0d\u603b\u662f\u4f60\u6240\u9884\u671f\u5f97\u5230\u7684\u3002<\/p>\n
[-c]cancelcurrentprocess\u53d6\u6d88\u76ee\u524d\u6b63\u5728\u6267\u884c\u7684\u6b7b\u673a\u7a0b\u5e8f\u3002\u6240\u4ee5\u8fd9\u4e2a\u9009\u9879\u5176\u5b9e\u6ca1\u6709<\/p>\n
<\/p>\n
\u65f6\u95f4\u53c2\u6570\ufe50\u5e76\u4e14\u53ef\u4ee5\u8f93\u5165\u4e00\u4e2a\u62ff\u6765\u89e3\u91ca\u7684\u8baf\u606f\ufe50\u800c\u8fd9\u4fe1\u606f\u5c06\u4f1a\u9001\u5230\u6bcf\u4e2a\u4f7f\u7528\u8005\u3002<\/p>\n
[-f]\u5728\u91cd\u542f\u4f30\u7b97\u5668\u3014reboot\u3015\u65f6\u5ffd\u89c6fsck\u3002<\/p>\n
[-F]\u5728\u91cd\u542f\u4f30\u7b97\u5668\u3014reboot\u3015\u65f6\u903c\u8febfsck\u3002<\/p>\n
[-time]\u8bbe\u5b9a\u6b7b\u673a\u3014shutdown\u3015\u524d\u7684\u65f6\u95f4\u3002<\/p>\n
2.halt\u2014-\u6700\u7b80\u5355\u7684\u6b7b\u673a\u547d\u4ee4<\/p>\n
\u867d\u7136halt\u5c31\u662f\u8c03\u7528shutdown-h\u3002halt\u6267\u884c\u65f6\ufe50\u6740\u5bb3\u5e94\u7528\u8fdb\u7a0b\ufe50\u6267\u884csync\u7cfb\u7edf\u8c03\u7528\ufe50<\/p>\n
\u6587\u4ef6\u7cfb\u7edf\u5199\u64cd\u4f5c\u5b8c\u6210\u540e\u624d\u4f1a\u505c\u6b62\u5185\u6838\u3002<\/p>\n
\u53c2\u6570\u8bf4\u660e:<\/p>\n
[-n]\u907f\u514dsync\u7cfb\u7edf\u8c03\u7528\ufe50\u5b83\u7528\u5728\u7528fsck\u4fee\u590d\u6839\u5206\u533a\u4ee5\u540e\ufe50\u4ee5\u5236\u6b62\u5185\u6838\u7528\u8001\u7248\u672c\u7684\u8d85<\/p>\n
<\/p>\n
\u7ea7\u5757\u3014superblock\u3015\u8986\u76d6\u4fee\u590d\u8fc7\u7684\u8d85\u7ea7\u5757\u3002<\/p>\n
[-w]\u5e76\u4e0d\u662f\u771f\u6b63\u7684\u91cd\u542f\u6216\u6b7b\u673a\ufe50\u53ea\u662f\u5199wtmp\u3014\/var\/log\/wtmp\u3015\u7eaa\u5f55\u3002<\/p>\n
[-d]\u4e0d\u5199wtmp\u7eaa\u5f55\u3014\u5df2\u5305\u542b\u5728\u9009\u9879[-n]\u4e2d\u3015\u3002<\/p>\n
[-f]\u6ca1\u6709\u8c03\u7528shutdown\u800c\u5f3a\u5236\u6b7b\u673a\u6216\u91cd\u542f\u3002<\/p>\n
[-i]\u6b7b\u673a\u3014\u6216\u91cd\u542f\u3015\u524d\ufe50\u5173\u95ed\u6240\u6709\u7684\u7f51\u8def\u63d2\u53e3\u3002<\/p>\n
[-p]\u8be5\u9009\u9879\u4e3a\u7f3a\u7701\u9009\u9879\u3002\u5c31\u662f\u6b7b\u673a\u65f6\u8c03\u7528poweroff\u3002<\/p>\n
3.reboot<\/p>\n
reboot\u7684\u5de5\u4f5c\u8fc7\u7a0b\u5dee\u4e0d\u591a\u8ddfhalt\u4e00\u6837\ufe50\u4e0d\u8fc7\u5b83\u662f\u5f15\u8d77\u4e3b\u673a\u91cd\u542f\ufe50\u800chalt\u662f\u6b7b\u673a\u3002\u5b83<\/p>\n
\u7684\u53c2\u6570\u4e0ehalt\u76f8\u5dee\u4e0d\u591a\u3002<\/p>\n
4.init<\/p>\n
init\u662f\u6240\u6709\u8fdb\u7a0b\u7684\u5148\u7956\ufe50\u5b83\u7684\u8fdb\u7a0b\u53f7\u4e00\u76f4\u4e3a1\ufe50\u6240\u4ee5\u53d1\u9001TERM\u8baf\u53f7\u7ed9init\u4f1a\u4e2d\u6b62\u6240\u6709\u7684<\/p>\n
\u7528\u6237\u8fdb\u7a0b\ufe51\u5b88\u62a4\u8fdb\u7a0b\u7b49\u3002shutdown\u5c31\u662f\u4f7f\u7528\u8fd9\u4e9b\u673a\u5236\u3002init\u5b9a\u4e49\u4e868\u4e2a\u8fd0\u884c\u7ea7\u522b(runlevel)arm linux\uff0c<\/p>\n
init0\u4e3a\u6b7b\u673a\ufe50init1\u4e3a\u91cd\u542f\u3002\u5173\u4e8einit\u53ef\u4ee5\u77ed\u7bc7\u5927\u8bba\ufe50\u8fd9\u513f\u5c31\u4e0d\u518d\u8868\u8ff0\u3002\u53e6\u5916\u8fd8\u6709<\/p>\n
telinit\u547d\u4ee4\u53ef\u4ee5\u6539\u53d8init\u7684\u8fd0\u884c\u7ea7\u522b\ufe50\u4f8b\u5982\ufe50telinit-iS\u53ef\u4f7f\u7cfb\u7edf\u6b65\u5165\u5355\u7528\u6237\u6a21\u5f0f\ufe50<\/p>\n
\u4f46\u662f\u5f97\u4e0d\u5230\u4f7f\u7528shutdown\u65f6\u7684\u4fe1\u606f\u548c\u7b49\u5f85\u65f6\u95f4\u3002<\/p>\n
linux\u600e\u4e48\u66f4\u6539root\u7ba1\u7406\u5458\u5bc6\u7801<\/p>\n
\u4ee5root\u8eab\u5206\u767b\u5165(SSH\u64cd\u4f5c)<\/p>\n
\u8f93\u5165passwd\u547d\u4ee4\u5c31\u53ef\u4ee5\u770b\u89c1\u63d0\u793a\u8f93\u5165\u65b0\u5bc6\u7801\u4e86<\/p>\n","protected":false},"excerpt":{"rendered":"
centos\u5173\u673a\u4e0e\u91cd\u542f\u547d\u4ee4\u8be6\u89e3\u4e0e\u5b9e\u6218centos\u91cd\u542f\u547d\u4ee4\uff1acentos\u5173\u673a\u547d\u4ee4\uff1a\u56e0\u4e3alinux\u4e0ewindows\u4e0d\u540c\uff0c\u5176\u540e\u53f0\u8fd0\u884c\u7740\u8bb8\u591a\u8fdb\u7a0b\uff0c\u6240\u4ee5\u5f3a\u5236\u5173\u673a\u53ef\u80fd\u5728\u91cd\u542f\u8ba1\u7b97\u5668\u3014reboot\u3015\u65f6\u5f3a\u8febfsck\u3002linux\u5982\u4f55\u4fee\u6539root\u7ba1\u7406\u5458\u5bc6\u7801<\/p>\n","protected":false},"author":1,"featured_media":293319,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[109,3293,1394,3292,1292],"class_list":["post-293318","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-linux","tag-runlevel","tag-s-13","tag-qxcq","tag-dy"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/293318","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=293318"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/293318\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/293319"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=293318"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=293318"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=293318"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}