{"id":557,"date":"2017-02-14T01:35:57","date_gmt":"2017-02-13T17:35:57","guid":{"rendered":"http:\/\/192.168.1.20\/?p=557"},"modified":"2017-02-14T01:35:57","modified_gmt":"2017-02-13T17:35:57","slug":"linux-{d4daabd1ba368d9860c36387ddb72bbda14f8f9559d69d60a952800885260c03}e5{d4daabd1ba368d9860c36387ddb72bbda14f8f9559d69d60a952800885260c03}85{47dd41ec6bdcbd9a214c783a3735392b82ea6d1d918378c5a53e06407","status":"publish","type":"post","link":"http:\/\/alextop.top\/?p=557","title":{"rendered":"linux \u5173\u673a\u547d\u4ee4\u603b\u7ed3"},"content":{"rendered":"<p style=\"background: white\"><span style=\"color:#494949; font-family:\u5b8b\u4f53\">linux\u4e0b\u5e38\u7528\u7684\u5173\u673a\u547d\u4ee4\u6709\uff1ashutdown\u3001halt\u3001poweroff\u3001init\uff1b\u91cd\u542f\u547d\u4ee4\u6709\uff1areboot\u3002\u4e0b\u9762\u672c\u6587\u5c31\u4e3b\u8981\u4ecb\u7ecd\u4e00\u4e9b\u5e38\u7528\u7684\u5173\u673a\u547d\u4ee4\u4ee5\u53ca\u5404\u79cd\u5173\u673a\u547d\u4ee4\u4e4b\u95f4\u7684\u533a\u522b\u548c\u5177\u4f53\u7528\u6cd5\u3002<br \/>\n<\/span><\/p>\n<p style=\"background: white\"><span style=\"color:red; font-family:\u5b8b\u4f53\"><strong>\u9996\u5148\u6765\u770b\u4e00\u4e0blinux\u4e0b\u6bd4\u8f83\u5e38\u7528\u7684\u4e00\u4e9b\u5173\u673a\u547d\u4ee4<\/strong><span style=\"color:#494949\"><br \/>\n\t\t\t<\/span><\/span><\/p>\n<p style=\"background: white\"><span style=\"color:#494949; font-family:\u5b8b\u4f53\"><strong>\u5173\u673a\u547d\u4ee4\uff1a<\/strong><br \/>\n\t\t<\/span><\/p>\n<p style=\"background: white\"><span style=\"color:#494949; font-family:\u5b8b\u4f53\">1\u3001halt\u00a0\u00a0 \u7acb\u523b\u5173\u673a 2\u3001poweroff\u00a0 \u7acb\u523b\u5173\u673a 3\u3001shutdown -h now \u7acb\u523b\u5173\u673a(root\u7528\u6237\u4f7f\u7528) 4\u3001shutdown -h 10 10\u5206\u949f\u540e\u81ea\u52a8\u5173\u673a \u5982\u679c\u662f\u901a\u8fc7shutdown\u547d\u4ee4\u8bbe\u7f6e\u5173\u673a\u7684\u8bdd\uff0c\u53ef\u4ee5\u7528shutdown -c\u547d\u4ee4\u53d6\u6d88\u91cd\u542f<br \/>\n<\/span><\/p>\n<p style=\"background: white\"><span style=\"color:#494949; font-family:\u5b8b\u4f53\"><strong>\u91cd\u542f\u547d\u4ee4\uff1a<\/strong><br \/>\n\t\t<\/span><\/p>\n<p style=\"background: white\"><span style=\"color:#494949; font-family:\u5b8b\u4f53\">1\u3001reboot 2\u3001shutdown -r now \u7acb\u523b\u91cd\u542f(root\u7528\u6237\u4f7f\u7528) 3\u3001shutdown -r 10 \u8fc710\u5206\u949f\u81ea\u52a8\u91cd\u542f(root\u7528\u6237\u4f7f\u7528)\u00a0 4\u3001shutdown -r 20:35 \u5728\u65f6\u95f4\u4e3a20:35\u65f6\u5019\u91cd\u542f(root\u7528\u6237\u4f7f\u7528) \u5982\u679c\u662f\u901a\u8fc7shutdown\u547d\u4ee4\u8bbe\u7f6e\u91cd\u542f\u7684\u8bdd\uff0c\u53ef\u4ee5\u7528shutdown -c\u547d\u4ee4\u53d6\u6d88\u91cd\u542f<br \/>\n<\/span><\/p>\n<p style=\"background: white\"><span style=\"color:red; font-family:\u5b8b\u4f53\"><strong>\u4e0b\u9762\u6211\u4eec\u6765\u770b\u770blinux\u7684\u8fd9\u4e9b\u5177\u4f53\u7684\u5173\u673a\u547d\u4ee4\u4e4b\u95f4\u7684\u533a\u522b\u548c\u5404\u81ea\u7684\u7528\u6cd5<\/strong><span style=\"color:#494949\"><br \/>\n\t\t\t<\/span><\/span><\/p>\n<p style=\"background: white\"><span style=\"color:#494949; font-family:\u5b8b\u4f53\"><strong>1.shutdown \u5b89\u5168\u7684\u5173\u673a\u547d\u4ee4<\/strong><br \/>\n\t\t<\/span><\/p>\n<p style=\"background: white\"><span style=\"color:#494949; font-family:\u5b8b\u4f53\">\u5bf9\u4e8eshutdown\u547d\u4ee4\uff0c\u5b83\u662f\u5927\u5bb6\u90fd\u63a8\u8350\u7684\u4e00\u4e2a\u5b89\u5168\u7684\u547d\u4ee4\uff0c\u901a\u8fc7\u53c2\u6570-h\u6216-r\u7684\u914d\u5408\u6765\u5b8c\u6210\u5173\u673a\u6216\u91cd\u542f\u3002\u4e0d\u8fc7\u5728linux\u7cfb\u7edf\u4e2d\u53ea\u6709\u62e5\u6709root\u6743\u9650\u624d\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e2a\u547d\u4ee4\u3002\u6240\u4ee5\uff0c\u867d\u7136\u5927\u5bb6\u90fd\u63a8\u8350\u7528\u8fd9\u4e2a\u547d\u4ee4\uff0c\u4f46\u662f\u8fd9\u4e2a\u547d\u4ee4\u7528\u8d77\u6765\u771f\u7684\u4e0d\u592a\u65b9\u4fbf\uff1a\u60f3\u8981\u7528\u8fd9\u4e2a\u547d\u4ee4\u5417\uff1f\u5148\u53bb\u83b7\u5f97root\u6743\u9650\u5427\u3002shutdown\u6267\u884c\u5173\u673a\uff0c\u662f\u9001\u4fe1\u53f7\u7ed9init\uff0c\u8981\u6c42\u5b83\u6539\u53d8\u8fd0\u884c\u7ea7\u522b\uff0c\u4ee5\u6b64\u6765\u5173\u673a\u3002\u5173\u673a\u6216\u91cd\u542f\u5b9e\u9645\u4e0a\u662f\u8fd0\u884c\u7ea7\u522b\u7684\u8c03\u6574\uff0c\u6240\u4ee5\u6211\u4eec\u4e5f\u53ef\u4ee5\u7528init\u76f4\u63a5\u8c03\u6574\u8fd0\u884c\u7ea7\u522b\u6765\u8fdb\u884c\u5173\u673a\u6216\u91cd\u542f\u3002\u4f7f\u7528\u8fd9\u4e2a\u547d\u4ee4\u65f6\uff0c\u673a\u5668\u7acb\u5373\u5173\u673a\u6216\u91cd\u542f\u3002\u5b83\u4e5f\u9700\u8981root\u6743\u9650\u3002<br \/>\n<\/span><\/p>\n<p style=\"background: white\"><span style=\"color:#494949; font-family:\u5b8b\u4f53\"><strong>\u90a3\u4e48\u4e3a\u4ec0\u4e48\u8bf4shutdown\u547d\u4ee4\u662f\u5b89\u5168\u5730\u5c06\u7cfb\u7edf\u5173\u673a\u5462\uff1f<\/strong><br \/>\n\t\t<\/span><\/p>\n<p style=\"background: white\"><span style=\"color:#494949; font-family:\u5b8b\u4f53\">\u5b9e\u9645\u4e2d\u6709\u4e9b\u7528\u6237\u4f1a\u4f7f\u7528\u76f4\u63a5\u65ad\u6389\u7535\u6e90\u7684\u65b9\u5f0f\u6765\u5173\u95edlinux\uff0c\u8fd9\u662f\u5341\u5206\u5371\u9669\u7684\u3002\u56e0\u4e3a<a href=\"http:\/\/www.phpernote.com\/linux\/\" target=\"_blank\"><span style=\"color:red; text-decoration:underline\">linux<\/span><\/a>\u4e0e<a href=\"http:\/\/www.phpernote.com\/windows-7\/\" target=\"_blank\"><span style=\"color:red; text-decoration:underline\">windows<\/span><\/a>\u4e0d\u540c\uff0c\u5176\u540e\u53f0\u8fd0\u884c\u7740\u8bb8\u591a\u8fdb\u7a0b\uff0c\u6240\u4ee5\u5f3a\u5236\u5173\u673a\u53ef\u80fd\u4f1a\u5bfc\u81f4\u8fdb\u7a0b\u7684\u6570\u636e\u4e22\u5931\u4f7f\u7cfb\u7edf\u5904\u4e8e\u4e0d\u7a33\u5b9a\u7684\u72b6\u6001\u3002\u751a\u81f3\u5728\u6709\u7684\u7cfb\u7edf\u4e2d\u4f1a\u635f\u574f\u786c\u4ef6\u8bbe\u5907\u3002\u800c\u5728\u7cfb\u7edf\u5173\u673a\u524d\u4f7f\u7528shutdown\u547d\u4ee4\uff0c\u7cfb\u7edf\u7ba1\u7406\u5458\u4f1a\u901a\u77e5\u6240\u6709\u767b\u5f55\u7684\u7528\u6237\u7cfb\u7edf\u5c06\u8981\u5173\u95ed\u3002\u5e76\u4e14login\u6307\u4ee4\u4f1a\u88ab\u51bb\u7ed3\uff0c\u5373\u65b0\u7684\u7528\u6237\u4e0d\u80fd\u518d\u767b\u5f55\u3002\u76f4\u63a5\u5173\u673a\u6216\u8005\u5ef6\u8fdf\u4e00\u5b9a\u7684\u65f6\u95f4\u624d\u5173\u673a\u90fd\u662f\u53ef\u80fd\u7684\uff0c\u8fd8\u6709\u53ef\u80fd\u662f\u91cd\u542f\u3002\u8fd9\u662f\u7531\u6240\u6709\u8fdb\u7a0b\u3014process\u3015\u90fd\u4f1a\u6536\u5230\u7cfb\u7edf\u6240\u9001\u8fbe\u7684\u4fe1\u53f7\u3014signal\u3015\u51b3\u5b9a\u7684\u3002<br \/>\n<\/span><\/p>\n<p style=\"background: white\"><span style=\"color:#494949; font-family:\u5b8b\u4f53\">shutdown\u6267\u884c\u5b83\u7684\u5de5\u4f5c\u662f\u9001\u4fe1\u53f7\u3014signal\u3015\u7ed9init\u7a0b\u5e8f\uff0c\u8981\u6c42\u5b83\u6539\u53d8 runlevel\u3002runlevel 0 \u88ab\u7528\u6765\u505c\u673a\u3014halt\u3015\uff0crunlevel 6 \u662f\u7528\u6765\u91cd\u65b0\u6fc0\u6d3b\u3014reboot\u3015\u7cfb\u7edf\uff0c\u800c runlevel 1\u5219\u662f\u88ab\u7528\u6765\u8ba9\u7cfb\u7edf\u8fdb\u5165\u7ba1\u7406\u5de5\u4f5c\u53ef\u4ee5\u8fdb\u884c\u7684\u72b6\u6001\uff0c\u8fd9\u662f\u9884\u8bbe\u7684\u3002\u5047\u5b9a\u6ca1\u6709-h\u4e5f\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\u54ea\u4e9b\u52a8\u4f5c\uff1f\u4f60\u53ef\u4ee5\u5728\u8fd9\u4e2a\u6587\u4ef6\/etc\/inittab\u91cc\u770b\u5230\u8fd9\u4e9brunlevels\u76f8\u5173\u7684\u8d44\u6599\u3002<br \/>\n<\/span><\/p>\n<p style=\"background: white\"><span style=\"color:#494949; font-family:\u5b8b\u4f53\">shutdown \u53c2\u6570\u8bf4\u660e:<br \/>\n<\/span><\/p>\n<p style=\"background: white\"><span style=\"color:#494949; font-family:\u5b8b\u4f53\">[-t] \u5728\u6539\u53d8\u5230\u5176\u5b83runlevel\u4e4b\u524d\uff0c\u544a\u8bc9init\u591a\u4e45\u4ee5\u540e\u5173\u673a\u3002 [-r] \u91cd\u542f\u8ba1\u7b97\u5668\u3002 [-k] \u5e76\u4e0d\u771f\u6b63\u5173\u673a\uff0c\u53ea\u662f\u9001\u8b66\u544a\u4fe1\u53f7\u7ed9\u6bcf\u4f4d\u767b\u5f55\u8005\u3014login\u3015\u3002 [-h] \u5173\u673a\u540e\u5173\u95ed\u7535\u6e90\u3014halt\u3015\u3002 [-n] \u4e0d\u7528init\u800c\u662f\u81ea\u5df1\u6765\u5173\u673a\u3002\u4e0d\u9f13\u52b1\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\uff0c\u800c\u4e14\u8be5\u9009\u9879\u6240\u4ea7\u751f\u7684\u540e\u679c\u5f80\u5f80\u4e0d\u603b\u662f\u4f60\u6240\u9884\u671f\u5f97\u5230\u7684\u3002 [-c] cancel current process\u53d6\u6d88\u76ee\u524d\u6b63\u5728\u6267\u884c\u7684\u5173\u673a\u7a0b\u5e8f\u3002\u6240\u4ee5\u8fd9\u4e2a\u9009\u9879\u5f53\u7136\u6ca1\u6709\u65f6\u95f4\u53c2\u6570\uff0c\u4f46\u662f\u53ef\u4ee5\u8f93\u5165\u4e00\u4e2a\u7528\u6765\u89e3\u91ca\u7684\u8baf\u606f\uff0c\u800c\u8fd9\u4fe1\u606f\u5c06\u4f1a\u9001\u5230\u6bcf\u4f4d\u4f7f\u7528\u8005\u3002 [-f] \u5728\u91cd\u542f\u8ba1\u7b97\u5668\u3014reboot\u3015\u65f6\u5ffd\u7565fsck\u3002\u00a0\u00a0 [-F] \u5728\u91cd\u542f\u8ba1\u7b97\u5668\u3014reboot\u3015\u65f6\u5f3a\u8febfsck\u3002 [-time] \u8bbe\u5b9a\u5173\u673a\u3014shutdown\u3015\u524d\u7684\u65f6\u95f4\u3002 \u3000\u3000 \u3000\u3000 <strong>2.halt \u6700\u7b80\u5355\u7684\u5173\u673a\u547d\u4ee4<\/strong><br \/>\n\t\t<\/span><\/p>\n<p style=\"background: white\"><span style=\"color:#494949; font-family:\u5b8b\u4f53\">\u7528halt\u547d\u4ee4\u6765\u5173\u673a\u65f6\uff0c\u5b9e\u9645\u8c03\u7528\u7684\u662fshutdown -h\u3002halt \u6267\u884c\u65f6\u5c06\u6740\u6b7b\u5e94\u7528\u8fdb\u7a0b\uff0c\u6267\u884csync\u7cfb\u7edf\u8c03\u7528\u6587\u4ef6\u7cfb\u7edf\u5199\u64cd\u4f5c\u5b8c\u6210\u540e\u5c31\u4f1a\u505c\u6b62\u5185\u6838\u3002<br \/>\n<\/span><\/p>\n<p style=\"background: white\"><span style=\"color:#494949; font-family:\u5b8b\u4f53\">halt \u53c2\u6570\u8bf4\u660e:<br \/>\n<\/span><\/p>\n<p style=\"background: white\"><span style=\"color:#494949; font-family:\u5b8b\u4f53\">[-n] \u9632\u6b62sync\u7cfb\u7edf\u8c03\u7528\uff0c\u5b83\u7528\u5728\u7528fsck\u4fee\u8865\u6839\u5206\u533a\u4e4b\u540e\uff0c\u4ee5\u963b\u6b62\u5185\u6838\u7528\u8001\u7248\u672c\u7684\u8d85\u7ea7\u5757\u3014superblock\u3015\u8986\u76d6\u4fee\u8865\u8fc7\u7684\u8d85\u7ea7\u5757\u3002 [-w] \u5e76\u4e0d\u662f\u771f\u6b63\u7684\u91cd\u542f\u6216\u5173\u673a\uff0c\u53ea\u662f\u5199wtmp\u3014\/var\/log\/wtmp\u3015\u7eaa\u5f55\u3002 [-d] \u4e0d\u5199wtmp\u7eaa\u5f55\u3014\u5df2\u5305\u542b\u5728\u9009\u9879[-n]\u4e2d\u3015\u3002 [-f] \u6ca1\u6709\u8c03\u7528shutdown\u800c\u5f3a\u5236\u5173\u673a\u6216\u91cd\u542f\u3002 [-i] \u5173\u673a\u3014\u6216\u91cd\u542f\u3015\u524d\u5173\u6389\u6240\u6709\u7684\u7f51\u7edc\u63a5\u53e3\u3002 [-p] \u8be5\u9009\u9879\u4e3a\u7f3a\u7701\u9009\u9879\u3002\u5c31\u662f\u5173\u673a\u65f6\u8c03\u7528poweroff\u3002<br \/>\n<\/span><\/p>\n<p style=\"background: white\"><span style=\"color:#494949; font-family:\u5b8b\u4f53\"><strong>3.poweroff \u5e38\u7528\u7684\u5173\u673a\u547d\u4ee4<\/strong><br \/>\n\t\t<\/span><\/p>\n<p style=\"background: white\"><span style=\"color:#494949; font-family:\u5b8b\u4f53\">\u5bf9\u4e8epoweroff\uff0c\u7f51\u4e0a\u8bf4\u5b83\u662fhalt\u547d\u4ee4\u7684\u94fe\u63a5\uff0c\u57fa\u672c\u7528\u6cd5\u548c halt \u5dee\u4e0d\u591a\uff0c\u8fd9\u91cc\u5c31\u4e0d\u591a\u8bf4\u4e86\u3002<br \/>\n<\/span><\/p>\n<p style=\"background: white\"><span style=\"color:#494949; font-family:\u5b8b\u4f53\"><strong>4.init<\/strong><br \/>\n\t\t<\/span><\/p>\n<p style=\"background: white\"><span style=\"color:#494949; font-family:\u5b8b\u4f53\">init\u662f\u6240\u6709\u8fdb\u7a0b\u7684\u7956\u5148\uff0c\u4ed6\u662fLinux\u7cfb\u7edf\u64cd\u4f5c\u4e2d\u4e0d\u53ef\u7f3a\u5c11\u7684\u7a0b\u5e8f\u4e4b\u4e00\u3002\u5b83\u7684\u8fdb\u7a0b\u53f7\u59cb\u7ec8\u4e3a1\uff0c\u6240\u4ee5\u53d1\u9001TERM\u4fe1\u53f7\u7ed9init\u4f1a\u7ec8\u6b62\u6240\u6709\u7684\u7528\u6237\u8fdb\u7a0b\uff0c\u5b88\u62a4\u8fdb\u7a0b\u7b49\u3002shutdown \u5c31\u662f\u4f7f\u7528\u8fd9\u79cd\u673a\u5236\u3002init\u5b9a\u4e49\u4e868\u4e2a\u8fd0\u884c\u7ea7\u522b(runlevel)\uff0cinit 0\u4e3a\u5173\u673a\uff0cinit 1\u4e3a\u91cd\u542f\u3002<br \/>\n<\/span><\/p>\n<p style=\"background: white\"><span style=\"color:#494949; font-family:\u5b8b\u4f53\"><strong>5.reboot \u91cd\u542f\u547d\u4ee4<\/strong><br \/>\n\t\t<\/span><\/p>\n<p style=\"background: white\"><span style=\"color:#494949; font-family:\u5b8b\u4f53\">reboot\u7684\u5de5\u4f5c\u8fc7\u7a0b\u5dee\u4e0d\u591a\u8ddfhalt\u4e00\u6837\u3002\u4e0d\u8fc7\u5b83\u662f\u5f15\u53d1\u4e3b\u673a\u91cd\u542f\uff0c\u800chalt\u662f\u5173\u673a\u3002\u5b83\u7684\u53c2\u6570\u4e0ehalt\u76f8\u5dee\u4e0d\u591a\u3002<br \/>\n<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>linux\u4e0b\u5e38\u7528\u7684\u5173\u673a\u547d\u4ee4\u6709\uff1a&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,15],"tags":[],"class_list":["post-557","post","type-post","status-publish","format-standard","hentry","category-jishu","category-reapberry"],"_links":{"self":[{"href":"http:\/\/alextop.top\/index.php?rest_route=\/wp\/v2\/posts\/557"}],"collection":[{"href":"http:\/\/alextop.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/alextop.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/alextop.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/alextop.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=557"}],"version-history":[{"count":0,"href":"http:\/\/alextop.top\/index.php?rest_route=\/wp\/v2\/posts\/557\/revisions"}],"wp:attachment":[{"href":"http:\/\/alextop.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=557"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/alextop.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=557"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/alextop.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=557"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}