{"id":446,"date":"2017-08-23T16:27:24","date_gmt":"2017-08-23T08:27:24","guid":{"rendered":"https:\/\/blog.haostudio.net\/hwp\/?p=446"},"modified":"2021-08-18T17:29:26","modified_gmt":"2021-08-18T09:29:26","slug":"%e5%9c%a8-debian-9-stretch-%e4%b8%ad%e5%95%9f%e7%94%a8%e6%b6%88%e5%a4%b1%e7%9a%84-rc-local","status":"publish","type":"post","link":"https:\/\/blog.haostudio.net\/hwp\/%e5%9c%a8-debian-9-stretch-%e4%b8%ad%e5%95%9f%e7%94%a8%e6%b6%88%e5%a4%b1%e7%9a%84-rc-local\/","title":{"rendered":"\u5728 Debian 9 (Stretch) \u4e2d\u555f\u7528\u6d88\u5931\u7684 rc.local"},"content":{"rendered":"<!--more-->\n<h2>\u5728 Debian 9 (Stretch) \u4e2d\u555f\u7528\u6d88\u5931\u7684 rc.local<\/h2>\n<p>Debian 9 (Stretch)\u9810\u8a2d\u4e0d\u4f7f\u7528\n<code>rc.local<\/code>, \u6240\u4ee5\u6703\u627e\u4e0d\u5230<code>\/etc\/rc.loca<\/code>l \u6a94.\n\u4f46\u662f\u9084\u662f\u6709\u8fa6\u6cd5\u53ef\u4ee5\u4f7f\u7528rc.local<\/p>\n<p>\u9996\u5148\u81ea\u5df1\u5148\u5275\u9020\n<code>\/etc\/rc.local<\/code>\u6a94 :<\/p>\n<pre><code># cat &lt;&lt;EOF &gt;\/etc\/rc.local\n#!\/bin\/sh -e\n1. 1. rc.local\n1. 1. This script is executed at the end of each multiuser runlevel.\n1. Make sure that the script will &quot;exit 0&quot; on success or any other\n1. value on error.\n1. 1. In order to enable or disable this script just change the execution\n1. bits.\n1. 1. By default this script does nothing.\n\nexit 0\nEOF\n<\/code><\/pre>\n<p>\u8a2d\u5b9a\u53ef\u57f7\u884c\u6b0a\u9650:<\/p>\n<pre><code># chmod +x \/etc\/rc.local\n<\/code><\/pre>\n<p>\u7136\u5f8c\u555f\u7528rc-local \u9019\u500b\u670d\u52d9\u5373\u53ef<\/p>\n<pre><code># systemctl start rc-local\n<\/code><\/pre>\n<p>\u89c0\u5bdfrc-local \u9019\u500b\u670d\u52d9\u662f\u5426\u5df2\u7d93\u555f\u52d5:<\/p>\n<pre><code># systemctl status rc-local\n\n\u25cf rc-local.service - \/etc\/rc.local Compatibility\n   Loaded: loaded (\/lib\/systemd\/system\/rc-local.service; static; vendor preset: enabled)\n  Drop-In: \/lib\/systemd\/system\/rc-local.service.d\n       \u2514\u2500debian.conf\n   Active: active (exited) since Wed 2017-08-16 14:12:44 CST; 5s ago\n  Process: 1256 ExecStart=\/etc\/rc.local start (code=exited, status=0\/SUCCESS)\n\nAug 16 14:12:44 vmsrv systemd[1]: Starting \/etc\/rc.local Compatibility...\nAug 16 14:12:44 vmsrv systemd[1]: Started \/etc\/rc.local Compatibility.\n<\/code><\/pre>\n<hr \/>\n<p>\u53c3\u8003\u8cc7\u6599: <a href=\"https:\/\/stackoverflow.com\/questions\/44797694\/where-is-rc-local-in-debian-9-debian-stretch\">Where is rc.local in Debian 9 (Debian Stretch)<\/a><\/p>","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,89],"tags":[9,103],"class_list":["post-446","post","type-post","status-publish","format-standard","hentry","category-linux","category-shell-script","tag-debian","tag-rc-local"],"_links":{"self":[{"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/posts\/446","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/comments?post=446"}],"version-history":[{"count":3,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/posts\/446\/revisions"}],"predecessor-version":[{"id":640,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/posts\/446\/revisions\/640"}],"wp:attachment":[{"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/media?parent=446"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/categories?post=446"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/tags?post=446"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}