{"id":845,"date":"2020-03-20T00:58:37","date_gmt":"2020-03-19T16:58:37","guid":{"rendered":"http:\/\/www.wjxy.net.cn\/?p=845"},"modified":"2024-04-06T18:27:46","modified_gmt":"2024-04-06T10:27:46","slug":"debian-9-rc-local%e8%ae%be%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/www.wjxy.net.cn\/?p=845","title":{"rendered":"Debian 9 rc.local\u8bbe\u7f6e"},"content":{"rendered":"\n<p>\u53ea\u9488\u5bf9Debian 9 stretch\uff0c\u901a\u5e38\u6765\u8bf4\uff0c\u9700\u8981\u81ea\u542f\u52a8\u7684\u5e94\u7528\u7a0b\u5e8f\u8def\u5f84\u90fd\u4f1a\u6dfb\u52a0\u5728\/etc\/rc.local\u8fd9\u4e2a\u6587\u4ef6\u91cc\u9762\uff0c\u7136\u800c\u641e\u7b11\u7684\u662f\uff0c\u5728Debian 9 stretch\u91cc\/etc\u8def\u5f84\u4e0b\uff0c\u6839\u672c\u5c31\u6ca1\u6709rc.local\u8fd9\u4e2a\u6587\u4ef6\uff0c\u4f46\u662f\uff01\uff01\uff01<\/p>\n\n\n\n<p>\u901a\u8fc7systemctl status rc-local\u5374\u80fd\u770b\u5230\uff0crc.local\u8fd9\u4e2a\u670d\u52a1\u5374\u662f\u5b58\u5728\u7684\u3002\u7d27\u8d34\u7740\u5e95\u90e8Active\u72b6\u6001\u9879\uff0c\u53ef\u4ee5\u770b\u5230\uff0c\u6b64\u65f6\u7684rc.local\u662f\u975e\u6d3b\u52a8\u7684\u670d\u52a1\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u4eec\u9700\u8981\u81ea\u5efarc.local\u6587\u4ef6\u3002\u63a7\u5236\u53f0\u8f93\u5165\u4fee\u6539\u4e24\u4e2a\u6587\u4ef6\uff0c\u7136\u540e\u6dfb\u52a0\u5982\u4e0b\u4ee3\u7801<\/p>\n\n\n\n<p>nano \/lib\/systemd\/system\/rc-local.service<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#  SPDX-License-Identifier: LGPL-2.1-or-later\r\n#\r\n#  This file is part of systemd.\r\n#\r\n#  systemd is free software; you can redistribute it and\/or modify it\r\n#  under the terms of the GNU Lesser General Public License as published by\r\n#  the Free Software Foundation; either version 2.1 of the License, or\r\n#  (at your option) any later version.\r\n\r\n# This unit gets pulled automatically into multi-user.target by\r\n# systemd-rc-local-generator if \/etc\/rc.local is executable.\r\n&#91;Unit]\r\nDescription=\/etc\/rc.local Compatibility\r\nDocumentation=man:systemd-rc-local-generator(8)\r\nConditionFileIsExecutable=\/etc\/rc.local\r\nAfter=network.target\r\n\r\n&#91;Service]\r\nType=forking\r\nExecStart=\/etc\/rc.local start\r\nTimeoutSec=0\r\nRemainAfterExit=yes\r\nGuessMainPID=no\r\n\r\n&#91;Install]\r\nWantedBy=multi-user.target<\/code><\/pre>\n\n\n\n<p>nano \/etc\/rc.local<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/sh -e\n#\n# rc.local\n#\n# This script is executed at the end of each multiuser runlevel.\n# Make sure that the script will \"exit 0\" on success or any other\n# value on error.\n#\n# In order to enable or disable this script just change the execution\n# bits.\n#\n# By default this script does nothing.\n\n##\/root\/frpc\/frpc -c \/root\/frpc\/frpc.ini > \/dev\/null 2>&amp;1 &amp;\nexit 0<\/code><\/pre>\n\n\n\n<p>\u8f93\u5165EOF\u65f6\u5c31\u4ee3\u8868\u4ee3\u7801\u6bb5\u7684\u7ed3\u675f\u3002\u9664\u4e86\u8fd9\u79cd\u65b9\u6cd5\u5916\uff0c\u81ea\u5df1\u4e5f\u53ef\u4ee5\u65b0\u5efa\u6587\u6863\uff0c\u901a\u8fc7vi\u6307\u4ee4\uff0c\u5411\u6587\u6863\u4e2d\u6dfb\u52a0\u76f8\u540c\u4ee3\u7801\uff08\u6b64\u65f6\u5c31\u4e0d\u9700\u8981\u8f93\u5165\u6700\u4e0b\u65b9\u7684EOF\u4e86\uff09\uff0c\u8bb0\u5f97\u6587\u6863\u540d\u5b57\u5fc5\u987b\u662frc.local\u5c31\u884c\u3002<\/p>\n\n\n\n<p>\u6587\u4ef6\u4fdd\u5b58\u5b8c\u6bd5\u540e\uff0c\u901a\u8fc7chmod +x rc.local\u7ed9\u6587\u4ef6\u52a0\u6743\u9650\uff0c\u7136\u540e\u79fb\u52a8\u6587\u4ef6\u5230\/etc\u8def\u5f84\u4e0b\uff0c<\/p>\n\n\n\n<p>\u542f\u52a8\u670d\u52a1\uff1asystemctl start rc-local <\/p>\n\n\n\n<p>\u5f00\u673a\u81ea\u542f\uff1asystemctl enable rc-local<\/p>\n\n\n\n<p>\u63a7\u5236\u53f0\u8f93\u5165systemctl status rc-local\u518d\u67e5\u770brc.local\u670d\u52a1\u72b6\u6001\uff0c\u53ef\u4ee5\u770b\u5230\u5df2\u7ecf\u662factive\u4e86\u3002<\/p>\n\n\n\n<p> \u6b64\u65f6\u8bf4\u660e\u81ea\u5efa\u7684rc.local\u6587\u4ef6\u968f\u7cfb\u7edf\u542f\u52a8\u5df2\u7ecf\u6ca1\u4ec0\u4e48\u95ee\u9898\u4e86\uff0c\u8fd9\u65f6\uff0c\u5c06\u81ea\u5df1\u9700\u8981\u5f00\u673a\u81ea\u52a8\u8fd0\u884c\u7684\u7a0b\u5e8f\u8def\u5f84\uff0c\u5199\u5230rc.local\u6587\u4ef6\u4e2d\u7684exit 0\u4e0a\u65b9\uff0c\u5373\u53ef\u5b8c\u6210\u81ea\u5b9a\u4e49\u5e94\u7528\u968f\u7cfb\u7edf\u5f00\u673a\u81ea\u542f\u52a8\u3002<\/p>\n\n\n\n<p>\u672c\u6587\u6765\u81ea:https:\/\/blog.csdn.net\/natty715\/article\/details\/89816535<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u53ea\u9488\u5bf9Debian 9 stretch\uff0c\u901a\u5e38\u6765\u8bf4\uff0c\u9700\u8981\u81ea\u542f\u52a8\u7684\u5e94\u7528\u7a0b\u5e8f\u8def\u5f84\u90fd\u4f1a\u6dfb\u52a0\u5728\/etc\/rc.local [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/www.wjxy.net.cn\/index.php?rest_route=\/wp\/v2\/posts\/845"}],"collection":[{"href":"https:\/\/www.wjxy.net.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wjxy.net.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wjxy.net.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wjxy.net.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=845"}],"version-history":[{"count":2,"href":"https:\/\/www.wjxy.net.cn\/index.php?rest_route=\/wp\/v2\/posts\/845\/revisions"}],"predecessor-version":[{"id":3337,"href":"https:\/\/www.wjxy.net.cn\/index.php?rest_route=\/wp\/v2\/posts\/845\/revisions\/3337"}],"wp:attachment":[{"href":"https:\/\/www.wjxy.net.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=845"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wjxy.net.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=845"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wjxy.net.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=845"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}