{"id":52191,"date":"2024-12-03T11:04:11","date_gmt":"2024-12-03T03:04:11","guid":{"rendered":"https:\/\/fwq.ai\/blog\/52191\/"},"modified":"2024-12-03T11:04:11","modified_gmt":"2024-12-03T03:04:11","slug":"linux%e7%b3%bb%e7%bb%9f%e5%90%af%e5%8a%a8%e8%bf%87%e7%a8%8b%e7%9a%84%e9%98%b6%e6%ae%b5%e6%9c%89%e5%93%aa%e4%ba%9b","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/52191\/","title":{"rendered":"Linux\u7cfb\u7edf\u542f\u52a8\u8fc7\u7a0b\u7684\u9636\u6bb5\u6709\u54ea\u4e9b"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>Linux\u7cfb\u7edf\u542f\u52a8\u8fc7\u7a0b\u7684\u9636\u6bb5\u6709\u54ea\u4e9b<\/h1>\n<p>\u5927\u5bb6\u597d\uff0c\u6211\u4eec\u53c8\u89c1\u9762\u4e86\u554a~\u672c\u6587<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300aLinux\u7cfb\u7edf\u542f\u52a8\u8fc7\u7a0b\u7684\u9636\u6bb5\u6709\u54ea\u4e9b\u300b<\/span>\u7684\u5185\u5bb9\u4e2d\u5c06\u4f1a\u6d89\u53ca\u5230<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\u3002\u5982\u679c\u4f60\u6b63\u5728\u5b66\u4e60<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u6587\u7ae0<\/span>\u76f8\u5173\u77e5\u8bc6\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\uff0c\u4ee5\u540e\u4f1a\u7ed9\u5927\u5bb6\u5e26\u6765\u66f4\u591a<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u6587\u7ae0<\/span>\u76f8\u5173\u6587\u7ae0\uff0c\u5e0c\u671b\u6211\u4eec\u80fd\u4e00\u8d77\u8fdb\u6b65\uff01\u4e0b\u9762\u5c31\u5f00\u59cb\u672c\u6587\u7684\u6b63\u5f0f\u5185\u5bb9~<\/p>\n<\/p>\n<blockquote>\n<p>\u7cfb\u7edf\u542f\u52a8\u8fc7\u7a0b\u76845\u4e2a\u9636\u6bb5\uff1a1\u3001\u5185\u6838\u5f15\u5bfc\u9636\u6bb5\uff1b\u5f53\u8ba1\u7b97\u673a\u6253\u5f00\u7535\u6e90\u540e\uff0c\u9996\u5148\u662fBIOS\u5f00\u673a\u81ea\u68c0\uff0c\u6309\u7167BIOS\u4e2d\u8bbe\u7f6e\u7684\u542f\u52a8\u8bbe\u5907\uff08\u901a\u5e38\u662f\u786c\u76d8\uff09\u6765\u542f\u52a8\u30022\u3001\u8fd0\u884cinit\u9636\u6bb5\uff1binit\u8fdb\u7a0b\u662f\u7cfb\u7edf\u6240\u6709\u8fdb\u7a0b\u7684\u8d77\u70b9\uff0c\u6ca1\u6709\u8fd9\u4e2a\u8fdb\u7a0b\uff0c\u7cfb\u7edf\u4e2d\u4efb\u4f55\u8fdb\u7a0b\u90fd\u4e0d\u4f1a\u542f\u52a8\u30023\u3001\u7cfb\u7edf\u521d\u59cb\u5316\u9636\u6bb5\uff1b\u8c03\u7528rc\u5b8c\u6210\u4e00\u4e9b\u7cfb\u7edf\u521d\u59cb\u5316\u7684\u5de5\u4f5c\u30024\u3001\u5efa\u7acb\u7ec8\u7aef\u9636\u6bb5\u30025\u3001\u7528\u6237\u767b\u5f55\u7cfb\u7edf\u3002<\/p>\n<\/blockquote>\n<h3><strong>Linux \u7cfb\u7edf\u542f\u52a8\u8fc7\u7a0b<\/strong><\/h3>\n<p>Linux\u7cfb\u7edf\u7684\u542f\u52a8\u8fc7\u7a0b\u5e76\u4e0d\u662f\u5927\u5bb6\u60f3\u8c61\u4e2d\u7684\u90a3\u4e48\u590d\u6742\uff0c\u5176\u8fc7\u7a0b\u53ef\u4ee5\u5206\u4e3a5\u4e2a\u9636\u6bb5\uff1a<\/p>\n<p>\uff081\uff09\u5185\u6838\u7684\u5f15\u5bfc\u3002<\/p>\n<p>\uff082\uff09\u8fd0\u884c init\u3002<\/p>\n<p>\uff083\uff09\u7cfb\u7edf\u521d\u59cb\u5316\u3002<\/p>\n<p>\uff084\uff09\u5efa\u7acb\u7ec8\u7aef \u3002<\/p>\n<p>\uff085\uff09\u7528\u6237\u767b\u5f55\u7cfb\u7edf\u3002<\/p>\n<p><strong>1\u3001\u5185\u6838\u5f15\u5bfc<\/strong><\/p>\n<p>\u3000\u3000\u5f53\u8ba1\u7b97\u673a\u6253\u5f00\u7535\u6e90\u540e\uff0c\u9996\u5148\u662fBIOS\u5f00\u673a\u81ea\u68c0\uff0c\u6309\u7167BIOS\u4e2d\u8bbe\u7f6e\u7684\u542f\u52a8\u8bbe\u5907\uff08\u901a\u5e38\u662f\u786c\u76d8\uff09\u6765\u542f\u52a8\u3002\u64cd\u4f5c\u7cfb\u7edf\u63a5\u7ba1\u786c\u4ef6\u4ee5\u540e\uff0c\u9996\u5148\u8bfb\u5165 \/boot \u76ee\u5f55\u4e0b\u7684\u5185\u6838\u6587\u4ef6\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20240415\/1713191792661d3b70ced61.jpg\" class=\"aligncenter\" title=\"Linux\u7cfb\u7edf\u542f\u52a8\u8fc7\u7a0b\u7684\u9636\u6bb5\u6709\u54ea\u4e9b\u63d2\u56fe\" alt=\"Linux\u7cfb\u7edf\u542f\u52a8\u8fc7\u7a0b\u7684\u9636\u6bb5\u6709\u54ea\u4e9b\u63d2\u56fe\" \/><\/p>\n<p><strong>2\u3001\u8fd0\u884c init<\/strong><\/p>\n<p>\uff081\uff09init \u8fdb\u7a0b\u662f\u7cfb\u7edf\u6240\u6709\u8fdb\u7a0b\u7684\u8d77\u70b9\uff0c\u4f60\u53ef\u4ee5\u628a\u5b83\u6bd4\u62df\u6210\u7cfb\u7edf\u6240\u6709\u8fdb\u7a0b\u7684\u8001\u7956\u5b97\uff0c\u6ca1\u6709\u8fd9\u4e2a\u8fdb\u7a0b\uff0c\u7cfb\u7edf\u4e2d\u4efb\u4f55\u8fdb\u7a0b\u90fd\u4e0d\u4f1a\u542f\u52a8\u3002init \u7a0b\u5e8f\u9996\u5148\u662f\u9700\u8981\u8bfb\u53d6\u914d\u7f6e\u6587\u4ef6 \/etc\/inittab\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20240415\/1713191792661d3b70d2389.jpg\" class=\"aligncenter\" title=\"Linux\u7cfb\u7edf\u542f\u52a8\u8fc7\u7a0b\u7684\u9636\u6bb5\u6709\u54ea\u4e9b\u63d2\u56fe1\" alt=\"Linux\u7cfb\u7edf\u542f\u52a8\u8fc7\u7a0b\u7684\u9636\u6bb5\u6709\u54ea\u4e9b\u63d2\u56fe1\" \/><\/p>\n<p>\uff082\uff09\u8fd0\u884c\u7ea7\u522b\uff1a\u8bb8\u591a\u7a0b\u5e8f\u9700\u8981\u5f00\u673a\u542f\u52a8\u3002\u5b83\u4eec\u5728Windows\u53eb\u505a&#8221;\u670d\u52a1&#8221;\uff08service\uff09\uff0c\u5728Linux\u5c31\u53eb\u505a&#8221;\u5b88\u62a4\u8fdb\u7a0b&#8221;\uff08daemon\uff09\u3002<\/p>\n<p>\u3000\u3000init \u8fdb\u7a0b\u7684\u4e00\u5927\u4efb\u52a1\uff0c\u5c31\u662f\u53bb\u8fd0\u884c\u8fd9\u4e9b\u5f00\u673a\u542f\u52a8\u7684\u7a0b\u5e8f\u3002\u4f46\u662f\uff0c\u4e0d\u540c\u7684\u573a\u5408\u9700\u8981\u542f\u52a8\u4e0d\u540c\u7684\u7a0b\u5e8f\uff0c\u6bd4\u5982\u7528\u4f5c\u670d\u52a1\u5668\u65f6\uff0c\u9700\u8981\u542f\u52a8Apache\uff0c\u7528\u4f5c\u684c\u9762\u5c31\u4e0d\u9700\u8981\u3002<\/p>\n<p>\u3000\u3000Linux\u5141\u8bb8\u4e3a\u4e0d\u540c\u7684\u573a\u5408\uff0c\u5206\u914d\u4e0d\u540c\u7684\u5f00\u673a\u542f\u52a8\u7a0b\u5e8f\uff0c\u8fd9\u5c31\u53eb\u505a&#8221;\u8fd0\u884c\u7ea7\u522b&#8221;\uff08runlevel\uff09\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u542f\u52a8\u65f6\u6839\u636e&#8221;\u8fd0\u884c\u7ea7\u522b&#8221;\uff0c\u786e\u5b9a\u8981\u8fd0\u884c\u54ea\u4e9b\u7a0b\u5e8f\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20240415\/1713191792661d3b70d4d2f.jpg\" class=\"aligncenter\" title=\"Linux\u7cfb\u7edf\u542f\u52a8\u8fc7\u7a0b\u7684\u9636\u6bb5\u6709\u54ea\u4e9b\u63d2\u56fe2\" alt=\"Linux\u7cfb\u7edf\u542f\u52a8\u8fc7\u7a0b\u7684\u9636\u6bb5\u6709\u54ea\u4e9b\u63d2\u56fe2\" \/><\/p>\n<p>\uff083\uff09Linux\u7cfb\u7edf\u67097\u4e2a\u8fd0\u884c\u7ea7\u522b(runlevel)\uff1a<\/p>\n<ul>\n<li>\n<p>\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<\/p>\n<\/li>\n<li>\n<p>\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<\/p>\n<\/li>\n<li>\n<p>\u8fd0\u884c\u7ea7\u522b2\uff1a\u591a\u7528\u6237\u72b6\u6001(\u6ca1\u6709NFS)<\/p>\n<\/li>\n<li>\n<p>\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<\/p>\n<\/li>\n<li>\n<p>\u8fd0\u884c\u7ea7\u522b4\uff1a\u7cfb\u7edf\u672a\u4f7f\u7528\uff0c\u4fdd\u7559<\/p>\n<\/li>\n<li>\n<p>\u8fd0\u884c\u7ea7\u522b5\uff1aX11\u63a7\u5236\u53f0\uff0c\u767b\u9646\u540e\u8fdb\u5165\u56fe\u5f62GUI\u6a21\u5f0f<\/p>\n<\/li>\n<li>\n<p>\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<\/p>\n<\/li>\n<\/ul>\n<p><strong>3\u3001\u7cfb\u7edf\u521d\u59cb\u5316<\/strong><\/p>\n<p>\u3000\u3000\u5728 init \u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u6709\u8fd9\u4e48\u4e00\u884c\uff1a si::sysinit:\/etc\/rc.d\/rc.sysinit\u3000\u5b83\u8c03\u7528\u6267\u884c\u4e86\/etc\/rc.d\/rc.sysinit\uff0c\u800c rc.sysinit \u662f\u4e00\u4e2a bash shell \u7684\u811a\u672c\uff0c\u5b83\u4e3b\u8981\u662f\u5b8c\u6210\u4e00\u4e9b\u7cfb\u7edf\u521d\u59cb\u5316\u7684\u5de5\u4f5c\uff0crc.sysinit\u662f\u6bcf\u4e00\u4e2a\u8fd0\u884c\u7ea7\u522b\u90fd\u8981\u9996\u5148\u8fd0\u884c\u7684\u91cd\u8981\u811a\u672c\u3002<\/p>\n<p>\u3000\u3000\u5b83\u4e3b\u8981\u5b8c\u6210\u7684\u5de5\u4f5c\u6709\uff1a\u6fc0\u6d3b\u4ea4\u6362\u5206\u533a\uff0c\u68c0\u67e5\u78c1\u76d8\uff0c\u52a0\u8f7d\u786c\u4ef6\u6a21\u5757\u4ee5\u53ca\u5176\u5b83\u4e00\u4e9b\u9700\u8981\u4f18\u5148\u6267\u884c\u4efb\u52a1\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20240415\/1713191792661d3b70d642b.jpg\" class=\"aligncenter\" title=\"Linux\u7cfb\u7edf\u542f\u52a8\u8fc7\u7a0b\u7684\u9636\u6bb5\u6709\u54ea\u4e9b\u63d2\u56fe3\" alt=\"Linux\u7cfb\u7edf\u542f\u52a8\u8fc7\u7a0b\u7684\u9636\u6bb5\u6709\u54ea\u4e9b\u63d2\u56fe3\" \/><\/p>\n<p><strong>4\u3001\u5efa\u7acb\u7ec8\u7aef\uff1a<\/strong><\/p>\n<p>rc \u6267\u884c\u5b8c\u6bd5\u540e\uff0c\u8fd4\u56de init\u3002\u8fd9\u65f6\u57fa\u672c\u7cfb\u7edf\u73af\u5883\u5df2\u7ecf\u8bbe\u7f6e\u597d\u4e86\uff0c\u5404\u79cd\u5b88\u62a4\u8fdb\u7a0b\u4e5f\u5df2\u7ecf\u542f\u52a8\u4e86\u3002init \u63a5\u4e0b\u6765\u4f1a\u6253\u5f006\u4e2a\u7ec8\u7aef\uff0c\u4ee5\u4fbf\u7528\u6237\u767b\u5f55\u7cfb\u7edf\u3002<\/p>\n<p><strong>5\u3001\u7528\u6237\u767b\u5f55\u7cfb\u7edf\uff1a<\/strong><\/p>\n<p>\u547d\u4ee4\u884c\u767b\u5f55\u3001ssh \u767b\u5f55\u3001\u56fe\u5f62\u754c\u9762\u767b\u5f55 3 \u79cd<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20240415\/1713191792661d3b70d7af4.jpg\" class=\"aligncenter\" title=\"Linux\u7cfb\u7edf\u542f\u52a8\u8fc7\u7a0b\u7684\u9636\u6bb5\u6709\u54ea\u4e9b\u63d2\u56fe4\" alt=\"Linux\u7cfb\u7edf\u542f\u52a8\u8fc7\u7a0b\u7684\u9636\u6bb5\u6709\u54ea\u4e9b\u63d2\u56fe4\" \/><\/p>\n<h4>\u9644\uff1aLinux \u5173\u673a<\/h4>\n<p>1\u3001\u6b63\u786e\u7684\u5173\u673a\u6d41\u7a0b\u4e3a\uff1async &gt; shutdown &gt; reboot &gt; halt<\/p>\n<p>2\u3001\u5173\u673a\u6307\u4ee4\u4e3a\uff1ashutdown \uff0c\u4f60\u53ef\u4ee5man shutdown \u6765\u770b\u4e00\u4e0b\u5e2e\u52a9\u6587\u6863\u3002<\/p>\n<p>3\u3001\u5b9e\u4f8b\uff1a<\/p>\n<pre>sync # \u5c06\u6570\u636e\u7531\u5185\u5b58\u540c\u6b65\u5230\u786c\u76d8\u4e2d\u3002shutdown \u2013h 10 \u2018This server will shutdown after 10 mins\u2019 #\u8fd9\u4e2a\u547d\u4ee4\u544a\u8bc9\u5927\u5bb6\uff0c\u8ba1\u7b97\u673a\u5c06\u572810\u5206\u949f\u540e\u5173\u673a\uff0c\u5e76\u4e14\u4f1a\u663e\u793a\u5728\u767b\u9646\u7528\u6237\u7684\u5f53\u524d\u5c4f\u5e55\u4e2d\u3002shutdown \u2013h now &nbsp; # \u7acb\u9a6c\u5173\u673ashutdown \u2013h 20:25 # \u7cfb\u7edf\u4f1a\u5728\u4eca\u592920:25\u5173\u673ashutdown \u2013h +10 &nbsp; # \u5341\u5206\u949f\u540e\u5173\u673ashutdown \u2013r now #\u7cfb\u7edf\u7acb\u9a6c\u91cd\u542fshutdown \u2013r +10 #\u7cfb\u7edf\u5341\u5206\u949f\u540e\u91cd\u542freboot &nbsp; # \u5c31\u662f\u91cd\u542f\uff0c\u7b49\u540c\u4e8e shutdown \u2013r nowhalt &nbsp; &nbsp; # \u5173\u95ed\u7cfb\u7edf\uff0c\u7b49\u540c\u4e8eshutdown \u2013h now \u548c poweroff<\/pre>\n<p>4\u3001\u4e0d\u7ba1\u662f\u91cd\u542f\u7cfb\u7edf\uff0c\u8fd8\u662f\u5173\u95ed\u7cfb\u7edf\uff0c\u9996\u5148\u8981\u8fd0\u884c sync \u547d\u4ee4\uff0c\u628a\u5185\u5b58\u4e2d\u7684\u6570\u636e\u5199\u5230\u78c1\u76d8\u4e2d\u3002<\/p>\n<p>\u3000\u3000\u5173\u673a\u7684\u547d\u4ee4\u6709 shutdown \u2013h now\u3001halt\u3001poweroff \u548c init 0\uff0c\u91cd\u542f\u7cfb\u7edf\u7684\u547d\u4ee4\u6709 shutdown \u2013r now\u3001reboot\u3001init 6\u3002<\/p>\n<p>5\u3001shutdown \u4f1a\u7ed9\u7cfb\u7edf\u8ba1\u5212\u4e00\u4e2a\u65f6\u95f4\u5173\u673a\uff0c\u5b83\u53ef\u4ee5\u88ab\u7528\u4e8e\u505c\u6b62\u3001\u5173\u673a\u3001\u91cd\u542f\u673a\u5668\u3002<\/p>\n<pre>shutdown&nbsp;-p&nbsp;now&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;\u5173\u95ed\u673a\u5668\nshutdown&nbsp;-H&nbsp;now&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;\u505c\u6b62\u673a\u5668&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\nshutdown&nbsp;-r&nbsp;09:35&nbsp;&nbsp;#&nbsp;\u5728&nbsp;09:35am&nbsp;\u91cd\u542f\u673a\u5668<\/pre>\n<p>\u3000\u3000\u8981\u53d6\u6d88\u5373\u5c06\u8fdb\u884c\u7684\u5173\u673a\uff0c\u53ea\u8981\u8f93\u5165\u4e0b\u9762\u7684\u547d\u4ee4\uff1a<\/p>\n<pre>shutdown&nbsp;-c<\/pre>\n<p>6\u3001halt \u547d\u4ee4\u901a\u77e5\u786c\u4ef6\u6765\u505c\u6b62\u6240\u6709\u7684 CPU \u529f\u80fd\uff0c\u4f46\u662f\u4ecd\u7136\u4fdd\u6301\u901a\u7535\u3002\u4f60\u53ef\u4ee5\u7528\u5b83\u4f7f\u7cfb\u7edf\u5904\u4e8e\u4f4e\u5c42\u7ef4\u62a4\u72b6\u6001\u3002\u6ce8\u610f\u5728\u6709\u4e9b\u60c5\u51b5\u4f1a\u5b83\u4f1a\u5b8c\u5168\u5173\u95ed\u7cfb\u7edf\u3002<\/p>\n<pre>#&nbsp;halt&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;###&nbsp;\u505c\u6b62\u673a\u5668\n#&nbsp;halt&nbsp;-p&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;###&nbsp;\u5173\u95ed\u673a\u5668\u3001\u5173\u95ed\u7535\u6e90\n#&nbsp;halt&nbsp;--reboot&nbsp;&nbsp;&nbsp;&nbsp;###&nbsp;\u91cd\u542f\u673a\u5668<\/pre>\n<p>\u3000\u3000poweroff \u4f1a\u53d1\u9001\u4e00\u4e2a ACPI \u4fe1\u53f7\u6765\u901a\u77e5\u7cfb\u7edf\u5173\u673a\u3002<\/p>\n<pre>#&nbsp;poweroff&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;###&nbsp;\u5173\u95ed\u673a\u5668\u3001\u5173\u95ed\u7535\u6e90\n#&nbsp;poweroff&nbsp;--halt&nbsp;&nbsp;&nbsp;&nbsp;###&nbsp;\u505c\u6b62\u673a\u5668\n#&nbsp;poweroff&nbsp;--reboot&nbsp;&nbsp;###&nbsp;\u91cd\u542f\u673a\u5668<\/pre>\n<p>\u3000\u3000reboot \u547d\u4ee4 reboot \u901a\u77e5\u7cfb\u7edf\u91cd\u542f\u3002<\/p>\n<pre>#&nbsp;reboot&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;###&nbsp;\u91cd\u542f\u673a\u5668\n#&nbsp;reboot&nbsp;--halt&nbsp;&nbsp;&nbsp;&nbsp;###&nbsp;\u505c\u6b62\u673a\u5668\n#&nbsp;reboot&nbsp;-p&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;###&nbsp;\u5173\u95ed\u673a\u5668<\/pre>\n<p>\u597d\u4e86\uff0c\u672c\u6587\u5230\u6b64\u7ed3\u675f\uff0c\u5e26\u5927\u5bb6\u4e86\u89e3\u4e86\u300aLinux\u7cfb\u7edf\u542f\u52a8\u8fc7\u7a0b\u7684\u9636\u6bb5\u6709\u54ea\u4e9b\u300b\uff0c\u5e0c\u671b\u672c\u6587\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff01\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff0c\u7ed9\u5927\u5bb6\u5206\u4eab\u66f4\u591a\u6587\u7ae0\u77e5\u8bc6\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux\u7cfb\u7edf\u542f\u52a8\u8fc7\u7a0b\u7684\u9636\u6bb5\u6709\u54ea\u4e9b \u5927\u5bb6\u597d\uff0c\u6211\u4eec\u53c8\u89c1\u9762\u4e86\u554a~\u672c\u6587\u300aLinux\u7cfb\u7edf\u542f\u52a8\u8fc7\u7a0b\u7684\u9636\u6bb5\u6709\u54ea\u4e9b\u300b\u7684\u5185\u5bb9\u4e2d\u5c06\u4f1a\u6d89\u53ca\u5230\u7b49\u7b49\u3002\u5982\u679c\u4f60\u6b63\u5728\u5b66\u4e60\u6587\u7ae0\u76f8\u5173\u77e5\u8bc6\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\uff0c\u4ee5\u540e\u4f1a\u7ed9\u5927\u5bb6\u5e26\u6765\u66f4\u591a\u6587\u7ae0\u76f8\u5173\u6587\u7ae0\uff0c\u5e0c\u671b\u6211\u4eec\u80fd\u4e00\u8d77\u8fdb\u6b65\uff01\u4e0b\u9762\u5c31\u5f00\u59cb\u672c\u6587\u7684\u6b63\u5f0f\u5185\u5bb9~ \u7cfb\u7edf\u542f\u52a8\u8fc7\u7a0b\u76845\u4e2a\u9636\u6bb5\uff1a1\u3001\u5185\u6838\u5f15\u5bfc\u9636\u6bb5\uff1b\u5f53\u8ba1\u7b97\u673a\u6253\u5f00\u7535\u6e90\u540e\uff0c\u9996\u5148\u662fBIOS\u5f00\u673a\u81ea\u68c0\uff0c\u6309\u7167BIOS\u4e2d\u8bbe\u7f6e\u7684\u542f\u52a8\u8bbe\u5907\uff08\u901a\u5e38\u662f\u786c\u76d8\uff09\u6765\u542f\u52a8\u30022\u3001\u8fd0\u884cinit\u9636\u6bb5\uff1binit\u8fdb\u7a0b\u662f\u7cfb\u7edf\u6240\u6709\u8fdb\u7a0b\u7684\u8d77\u70b9\uff0c\u6ca1\u6709\u8fd9\u4e2a\u8fdb\u7a0b\uff0c\u7cfb\u7edf\u4e2d\u4efb\u4f55\u8fdb\u7a0b\u90fd\u4e0d\u4f1a\u542f\u52a8\u30023\u3001\u7cfb\u7edf\u521d\u59cb\u5316\u9636\u6bb5\uff1b\u8c03\u7528rc\u5b8c\u6210\u4e00\u4e9b\u7cfb\u7edf\u521d\u59cb\u5316\u7684\u5de5\u4f5c\u30024\u3001\u5efa\u7acb\u7ec8\u7aef\u9636\u6bb5\u30025\u3001\u7528\u6237\u767b\u5f55\u7cfb\u7edf\u3002 Linux \u7cfb\u7edf\u542f\u52a8\u8fc7\u7a0b Linux\u7cfb\u7edf\u7684\u542f\u52a8\u8fc7\u7a0b\u5e76\u4e0d\u662f\u5927\u5bb6\u60f3\u8c61\u4e2d\u7684\u90a3\u4e48\u590d\u6742\uff0c\u5176\u8fc7\u7a0b\u53ef\u4ee5\u5206\u4e3a5\u4e2a\u9636\u6bb5\uff1a \uff081\uff09\u5185\u6838\u7684\u5f15\u5bfc\u3002 \uff082\uff09\u8fd0\u884c init\u3002 \uff083\uff09\u7cfb\u7edf\u521d\u59cb\u5316\u3002 \uff084\uff09\u5efa\u7acb\u7ec8\u7aef \u3002 \uff085\uff09\u7528\u6237\u767b\u5f55\u7cfb\u7edf\u3002 1\u3001\u5185\u6838\u5f15\u5bfc \u3000\u3000\u5f53\u8ba1\u7b97\u673a\u6253\u5f00\u7535\u6e90\u540e\uff0c\u9996\u5148\u662fBIOS\u5f00\u673a\u81ea\u68c0\uff0c\u6309\u7167BIOS\u4e2d\u8bbe\u7f6e\u7684\u542f\u52a8\u8bbe\u5907\uff08\u901a\u5e38\u662f\u786c\u76d8\uff09\u6765\u542f\u52a8\u3002\u64cd\u4f5c\u7cfb\u7edf\u63a5\u7ba1\u786c\u4ef6\u4ee5\u540e\uff0c\u9996\u5148\u8bfb\u5165 \/boot \u76ee\u5f55\u4e0b\u7684\u5185\u6838\u6587\u4ef6\u3002 2\u3001\u8fd0\u884c init \uff081\uff09init \u8fdb\u7a0b\u662f\u7cfb\u7edf\u6240\u6709\u8fdb\u7a0b\u7684\u8d77\u70b9\uff0c\u4f60\u53ef\u4ee5\u628a\u5b83\u6bd4\u62df\u6210\u7cfb\u7edf\u6240\u6709\u8fdb\u7a0b\u7684\u8001\u7956\u5b97\uff0c\u6ca1\u6709\u8fd9\u4e2a\u8fdb\u7a0b\uff0c\u7cfb\u7edf\u4e2d\u4efb\u4f55\u8fdb\u7a0b\u90fd\u4e0d\u4f1a\u542f\u52a8\u3002init \u7a0b\u5e8f\u9996\u5148\u662f\u9700\u8981\u8bfb\u53d6\u914d\u7f6e\u6587\u4ef6 \/etc\/inittab\u3002 \uff082\uff09\u8fd0\u884c\u7ea7\u522b\uff1a\u8bb8\u591a\u7a0b\u5e8f\u9700\u8981\u5f00\u673a\u542f\u52a8\u3002\u5b83\u4eec\u5728Windows\u53eb\u505a&#8221;\u670d\u52a1&#8221;\uff08service\uff09\uff0c\u5728Linux\u5c31\u53eb\u505a&#8221;\u5b88\u62a4\u8fdb\u7a0b&#8221;\uff08daemon\uff09\u3002 \u3000\u3000init \u8fdb\u7a0b\u7684\u4e00\u5927\u4efb\u52a1\uff0c\u5c31\u662f\u53bb\u8fd0\u884c\u8fd9\u4e9b\u5f00\u673a\u542f\u52a8\u7684\u7a0b\u5e8f\u3002\u4f46\u662f\uff0c\u4e0d\u540c\u7684\u573a\u5408\u9700\u8981\u542f\u52a8\u4e0d\u540c\u7684\u7a0b\u5e8f\uff0c\u6bd4\u5982\u7528\u4f5c\u670d\u52a1\u5668\u65f6\uff0c\u9700\u8981\u542f\u52a8Apache\uff0c\u7528\u4f5c\u684c\u9762\u5c31\u4e0d\u9700\u8981\u3002 \u3000\u3000Linux\u5141\u8bb8\u4e3a\u4e0d\u540c\u7684\u573a\u5408\uff0c\u5206\u914d\u4e0d\u540c\u7684\u5f00\u673a\u542f\u52a8\u7a0b\u5e8f\uff0c\u8fd9\u5c31\u53eb\u505a&#8221;\u8fd0\u884c\u7ea7\u522b&#8221;\uff08runlevel\uff09\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u542f\u52a8\u65f6\u6839\u636e&#8221;\u8fd0\u884c\u7ea7\u522b&#8221;\uff0c\u786e\u5b9a\u8981\u8fd0\u884c\u54ea\u4e9b\u7a0b\u5e8f\u3002 \uff083\uff09Linux\u7cfb\u7edf\u67097\u4e2a\u8fd0\u884c\u7ea7\u522b(runlevel)\uff1a \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 \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 \u8fd0\u884c\u7ea7\u522b2\uff1a\u591a\u7528\u6237\u72b6\u6001(\u6ca1\u6709NFS) \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 \u8fd0\u884c\u7ea7\u522b4\uff1a\u7cfb\u7edf\u672a\u4f7f\u7528\uff0c\u4fdd\u7559 \u8fd0\u884c\u7ea7\u522b5\uff1aX11\u63a7\u5236\u53f0\uff0c\u767b\u9646\u540e\u8fdb\u5165\u56fe\u5f62GUI\u6a21\u5f0f \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 3\u3001\u7cfb\u7edf\u521d\u59cb\u5316 \u3000\u3000\u5728 init \u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u6709\u8fd9\u4e48\u4e00\u884c\uff1a si::sysinit:\/etc\/rc.d\/rc.sysinit\u3000\u5b83\u8c03\u7528\u6267\u884c\u4e86\/etc\/rc.d\/rc.sysinit\uff0c\u800c rc.sysinit \u662f\u4e00\u4e2a bash shell \u7684\u811a\u672c\uff0c\u5b83\u4e3b\u8981\u662f\u5b8c\u6210\u4e00\u4e9b\u7cfb\u7edf\u521d\u59cb\u5316\u7684\u5de5\u4f5c\uff0crc.sysinit\u662f\u6bcf\u4e00\u4e2a\u8fd0\u884c\u7ea7\u522b\u90fd\u8981\u9996\u5148\u8fd0\u884c\u7684\u91cd\u8981\u811a\u672c\u3002 \u3000\u3000\u5b83\u4e3b\u8981\u5b8c\u6210\u7684\u5de5\u4f5c\u6709\uff1a\u6fc0\u6d3b\u4ea4\u6362\u5206\u533a\uff0c\u68c0\u67e5\u78c1\u76d8\uff0c\u52a0\u8f7d\u786c\u4ef6\u6a21\u5757\u4ee5\u53ca\u5176\u5b83\u4e00\u4e9b\u9700\u8981\u4f18\u5148\u6267\u884c\u4efb\u52a1\u3002 4\u3001\u5efa\u7acb\u7ec8\u7aef\uff1a rc \u6267\u884c\u5b8c\u6bd5\u540e\uff0c\u8fd4\u56de init\u3002\u8fd9\u65f6\u57fa\u672c\u7cfb\u7edf\u73af\u5883\u5df2\u7ecf\u8bbe\u7f6e\u597d\u4e86\uff0c\u5404\u79cd\u5b88\u62a4\u8fdb\u7a0b\u4e5f\u5df2\u7ecf\u542f\u52a8\u4e86\u3002init \u63a5\u4e0b\u6765\u4f1a\u6253\u5f006\u4e2a\u7ec8\u7aef\uff0c\u4ee5\u4fbf\u7528\u6237\u767b\u5f55\u7cfb\u7edf\u3002 5\u3001\u7528\u6237\u767b\u5f55\u7cfb\u7edf\uff1a \u547d\u4ee4\u884c\u767b\u5f55\u3001ssh \u767b\u5f55\u3001\u56fe\u5f62\u754c\u9762\u767b\u5f55 3 [&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-52191","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52191","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=52191"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52191\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=52191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=52191"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=52191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}