{"id":214299,"date":"2021-03-30T10:18:33","date_gmt":"2021-03-30T02:18:33","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=214299"},"modified":"2021-03-22T10:18:58","modified_gmt":"2021-03-22T02:18:58","slug":"linux-shutdown-ling","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-shutdown-ling.html","title":{"rendered":"\u5b66\u4e60\u4e00\u4e2a Linux \u547d\u4ee4\uff1ashutdown \u547d\u4ee4"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u4eca\u5929\u6765\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u4e00\u4e0blinux\u7684\u547d\u4ee4 shutdown<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

1.\u529f\u80fd<\/strong><\/div>\n

shutdown \u6307\u4ee4\u53ef\u4ee5\u5173\u95ed\u6240\u6709\u7a0b\u5e8f\uff0c\u5e76\u4f9d\u7528\u6237\u7684\u9700\u8981\uff0c\u8fdb\u884c\u91cd\u542f\u6216\u5173\u673a\u64cd\u4f5c\u3002<\/p>\n

\u4f7f\u7528 shutdown \u547d\u4ee4\u65f6\uff0c\u5728\u7cfb\u7edf\u5173\u673a\u524d\uff0c\u53ef\u4ee5\u901a\u77e5\u6240\u6709\u767b\u5f55\u8005\u7cfb\u7edf\u5c06\u8981\u5173\u95ed\u3002\u6b64\u65f6 login \u6307\u4ee4\u4f1a\u88ab\u51bb\u7ed3\uff0c\u65b0\u7528\u6237\u5c06\u4e0d\u80fd\u518d\u767b\u5f55\uff0c\u8fd9\u662f\u63a8\u8350\u4f7f\u7528\u7684\u5b89\u5168\u5173\u673a\u65b9\u5f0f\u3002\u5173\u673a\u4e4b\u524d\uff0c\u6240\u6709\u8fdb\u7a0b\u90fd\u4f1a\u53d7\u5230 shutdown \u6307\u4ee4\u6240\u53d1\u9001\u7684\u5173\u95ed\u8fdb\u7a0b\u4fe1\u53f7\uff0c\u7136\u540e\u5411 init \u7a0b\u5e8f\u53d1\u9001\u4fe1\u53f7\uff0c\u8981\u6c42\u5b83\u6539\u53d8\u8fd0\u884c\u7b49\u7ea7\uff08runlevel\uff09\u3002<\/p>\n

Linux \u7cfb\u7edf\u6709 7 \u4e2a\u8fd0\u884c\u7ea7\u522b\uff1a
\n\u8fd0\u884c\u7ea7\u522b0\uff1a\u7cfb\u7edf\u505c\u673a\u72b6\u6001\uff0c\u7cfb\u7edf\u9ed8\u8ba4\u8fd0\u884c\u7ea7\u522b\u4e0d\u80fd\u8bbe\u4e3a0\uff0c\u5426\u5219\u4e0d\u80fd\u6b63\u5e38\u542f\u52a8\uff1b
\n\u8fd0\u884c\u7ea7\u522b1\uff1a\u5355\u7528\u6237\u5de5\u4f5c\u72b6\u6001\uff0croot\u6743\u9650\uff0c\u7528\u4e8e\u7cfb\u7edf\u7ef4\u62a4\uff0c\u7981\u6b62\u8fdc\u7a0b\u767b\u9646\uff1b
\n\u8fd0\u884c\u7ea7\u522b2\uff1a\u591a\u7528\u6237\u72b6\u6001(\u6ca1\u6709NFS)\uff1b
\n\u8fd0\u884c\u7ea7\u522b3\uff1a\u5b8c\u5168\u7684\u591a\u7528\u6237\u72b6\u6001(\u6709NFS)\uff0c\u767b\u9646\u540e\u8fdb\u5165\u63a7\u5236\u53f0\u547d\u4ee4\u884c\u6a21\u5f0f\uff1b
\n\u8fd0\u884c\u7ea7\u522b4\uff1a\u7cfb\u7edf\u672a\u4f7f\u7528\uff0c\u4fdd\u7559\uff1b
\n\u8fd0\u884c\u7ea7\u522b5\uff1aX11\u63a7\u5236\u53f0\uff0c\u767b\u9646\u540e\u8fdb\u5165\u56fe\u5f62GUI\u6a21\u5f0f\uff1b
\n\u8fd0\u884c\u7ea7\u522b6\uff1a\u7cfb\u7edf\u6b63\u5e38\u5173\u95ed\u5e76\u91cd\u542f\uff0c\u9ed8\u8ba4\u8fd0\u884c\u7ea7\u522b\u4e0d\u80fd\u8bbe\u4e3a6\uff0c\u5426\u5219\u4e0d\u80fd\u6b63\u5e38\u542f\u52a8\u3002<\/p>\n

2.\u547d\u4ee4\u683c\u5f0f<\/strong><\/div>\n

shutdown [\u9009\u9879] [\u53c2\u6570]<\/p>\n

3.\u9009\u9879\u8bf4\u660e<\/strong><\/div>\n
-c\r\n cancel\uff0c\u5176\u4ed6\u7528\u6237\u53ef\u4ee5\u53d6\u6d88\u76ee\u524d\u6b63\u5728\u6267\u884c\u7684\u5173\u673a\u7a0b\u5e8f\uff0c\u6216\u8005Control-C\u7ec8\u6b62shutdown\u7a0b\u5e8f\r\n-k\r\n \u4ec5\u4ec5\u5411\u6bcf\u4e2a\u767b\u5f55\u7528\u6237\u53d1\u51fa\u8b66\u544a\u4fe1\u606f\uff0c\u5e76\u4e0d\u771f\u6b63\u5173\u673a\r\n-f\r\n \u91cd\u65b0\u542f\u52a8\u65f6\u4e0d\u6267\u884cfsck\u6587\u4ef6\u7cfb\u7edf\u68c0\u67e5\u547d\u4ee4\uff1b\r\n-F\r\n \u91cd\u65b0\u542f\u52a8\u65f6\u6267\u884cfsck\u6587\u4ef6\u7cfb\u7edf\u68c0\u67e5\u547d\u4ee4\uff1b\r\n-h\r\n \u5173\u673a\uff08halt\uff09\u6216\u5173\u95ed\u7535\u6e90\uff08power off\uff09\uff0c\u81f3\u4e8e\u9009\u62e9\u54ea\u4e00\u79cd\u53d6\u51b3\u4e8e\u7cfb\u7edf\u7684\u5173\u673a\u811a\u672c\uff08\u6709\u6642\u5019\u53ef\u4ee5\u5728 BIOS \u4e2d\u66f4\u6539\uff09\r\n-H\r\n \u5173\u673a\uff08halt\uff09\uff1b\r\n-P\r\n \u5173\u673a\uff0c\u7b49\u4ef7\u4e8e poweroff \u547d\u4ee4\r\n-n\r\n \u4e0d\u8c03\u7528 init \u7a0b\u5e8f\u8fdb\u884c\u5173\u673a\uff0c\u800c\u7531 shutdown \u81ea\u5df1\u8fdb\u884c\r\n-r\r\n \u91cd\u542f\u3002\u7b49\u4ef7\u4e8e reboot \u547d\u4ee4\r\n-t <\u79d2\u6570>\r\n \u9001\u51fa\u8b66\u544a\u4fe1\u606f\u548c\u5220\u9664\u4fe1\u606f\u4e4b\u95f4\u8981\u5ef6\u8fdf\u591a\u5c11\u79d2\r\n--help\r\n \u663e\u793a\u5e2e\u52a9\u4fe1\u606f\r\n--version\r\n \u663e\u793a\u7248\u672c<\/pre>\n
4.\u5e38\u7528\u793a\u4f8b<\/strong><\/div>\n
\uff081\uff09\u7acb\u523b\u5173\u673a\uff0c\u5176\u4e2d now \u76f8\u5f53\u4e8e\u65f6\u95f4\u4e3a 0 \u7684\u72b6\u6001\u3002<\/strong><\/span><\/div>\n
shutdown -H now\r\n\/\/\u6216\r\nhalt<\/pre>\n
\uff082\uff09\u7cfb\u7edf\u5728\u4eca\u5929\u7684 20\uff1a25 \u5206\u5173\u673a\u3002<\/strong><\/span><\/div>\n
shutdown -H 20:25<\/pre>\n
\uff083\uff09\u7cfb\u7edf\u7acb\u523b\u91cd\u65b0\u542f\u52a8\u3002<\/strong><\/span><\/div>\n
shutdown -r now\r\n\/\/\u6216\r\nreboot<\/pre>\n
\uff084\uff09\u53d1\u9001\u540e\u9762\u7684\u8b66\u544a\u4fe1\u606f\uff0c\u518d\u8fc7 30 \u5206\u949f\u7cfb\u7edf\u4f1a\u81ea\u52a8\u91cd\u542f\u3002<\/strong><\/span><\/div>\n
shutdown -r +30 'The system will reboot'<\/pre>\n
\uff085\uff09\u4ec5\u53d1\u51fa\u8b66\u544a\uff0c\u7cfb\u7edf\u5e76\u4e0d\u4f1a\u5173\u673a\u3002<\/strong><\/span><\/div>\n
shutdown -k now 'This is just a warning message'<\/pre>\n
\uff086\uff09\u7acb\u5373\u5173\u673a\u5e76\u5207\u65ad\u7535\u6e90\u3002<\/strong><\/span><\/div>\n
shutdown -P now\r\n\/\/\u6216\r\npoweroff<\/pre>\n
\uff087\uff09\u6076\u4f5c\u5267\uff0c\u4ec5\u53d1\u51fa\u8b66\u544a\uff0c\u4ec0\u4e48\u90fd\u4e0d\u4f1a\u53d1\u751f\u3002<\/strong><\/span><\/div>\n
shutdown +10 -k '10\u5206\u949f\u540e\u5173\u673a'<\/pre>\n
5.\u5e38\u89c1\u95ee\u9898<\/strong><\/div>\n
\uff081\uff09shutdown \\-h\u3001shutdown \\-H\u548cshutdown \\-P\u7684\u533a\u522b?<\/strong><\/span><\/div>\n

shutdown \\-H\u662f\u5173\u673a\u64cd\u4f5c\uff0c\u505c\u6b62\u7cfb\u7edf\u8fd0\u884c\uff0c\u4f46\u5e76\u672a\u5173\u95ed\u7535\u6e90\uff0cshutdown \\-P\u662f\u5173\u95ed\u7535\u6e90\u64cd\u4f5c\u3002shutdown \\-h\u5219\u6839\u636e\u7cfb\u7edf\u7684\u9ed8\u8ba4\u8bbe\u7f6e\u6765\u9009\u62e9\u662f\u5426\u5173\u95ed\u7535\u6e90 \u3002\u5173\u95ed\u7535\u6e90\u4f1a\u9001\u51fa ACPI \u6307\u4ee4\u901a\u77e5PSU\uff08Power Supply Unit\uff09\u7535\u6e90\u3002<\/p>\n

\uff082\uff09shutdown\u9ed8\u8ba4\u64cd\u4f5c\u8fdb\u5165\u5355\u7528\u6237\u7ef4\u62a4\u6a21\u5f0f\u3002<\/strong><\/span><\/div>\n

\/\/\u5341\u5206\u949f\u540e\u8fdb\u5165\u5355\u7528\u6237\u7ef4\u62a4\u6a21\u5f0f<\/p>\n

shutdown +10<\/pre>\n","protected":false},"excerpt":{"rendered":"

shutdown \u6307\u4ee4\u53ef\u4ee5\u5173\u95ed\u6240\u6709\u7a0b\u5e8f\uff0c\u5e76\u4f9d\u7528\u6237\u7684\u9700\u8981\uff0c\u8fdb\u884c\u91cd\u542f\u6216\u5173\u673a\u64cd\u4f5c\u3002 \u4f7f\u7528 shutdown \u547d\u4ee4\u65f6\uff0c […]<\/p>\n","protected":false},"author":1469,"featured_media":214303,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-214299","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/214299","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\/1469"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=214299"}],"version-history":[{"count":5,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/214299\/revisions"}],"predecessor-version":[{"id":214446,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/214299\/revisions\/214446"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/214303"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=214299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=214299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=214299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}