{"id":356,"date":"2019-09-25T17:19:22","date_gmt":"2019-09-25T09:19:22","guid":{"rendered":"https:\/\/wp.yaanren.win\/?p=356"},"modified":"2019-09-25T17:19:22","modified_gmt":"2019-09-25T09:19:22","slug":"ubuntu-18-04%e8%ae%be%e7%bd%ae%e5%bc%80%e6%9c%ba%e5%90%af%e5%8a%a8%e8%84%9a%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/wp.625300.xyz\/?p=356","title":{"rendered":"ubuntu-18.04\u8bbe\u7f6e\u5f00\u673a\u542f\u52a8\u811a\u672c"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8f6c\u8f7d\u81ea\uff1a <a href=\"https:\/\/www.cnblogs.com\/airdot\/p\/9688530.html\">https:\/\/www.cnblogs.com\/airdot\/p\/9688530.html<\/a> <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">ubuntu-18.04\u4e0d\u80fd\u50cfubuntu14\u4e00\u6837\u901a\u8fc7\u7f16\u8f91rc.local\u6765\u8bbe\u7f6e\u5f00\u673a\u542f\u52a8\u811a\u672c\uff0c\u901a\u8fc7\u4e0b\u5217\u7b80\u5355\u8bbe\u7f6e\u540e\uff0c\u53ef\u4ee5\u4f7frc.local\u91cd\u65b0\u53d1\u6325\u4f5c\u7528\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u5efa\u7acbrc-local.service\u6587\u4ef6<\/p>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>1<\/td><td><code>sudo<\/code>&nbsp;<code>vi<\/code>&nbsp;<code>\/etc\/systemd\/system\/rc-local<\/code><code>.service<\/code><\/td><\/tr><\/tbody><\/table>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u5c06\u4e0b\u5217\u5185\u5bb9\u590d\u5236\u8fdbrc-local.service\u6587\u4ef6<\/p>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>1234567891011121314<\/td><td><code>[Unit]<\/code><code>Description=<\/code><code>\/etc\/rc<\/code><code>.<\/code><code>local<\/code>&nbsp;<code>Compatibility<\/code><code>ConditionPathExists=<\/code><code>\/etc\/rc<\/code><code>.<\/code><code>local<\/code>&nbsp;<code>[Service]<\/code><code>Type=forking<\/code><code>ExecStart=<\/code><code>\/etc\/rc<\/code><code>.<\/code><code>local<\/code>&nbsp;<code>start<\/code><code>TimeoutSec=0<\/code><code>StandardOutput=<\/code><code>tty<\/code><code>RemainAfterExit=<\/code><code>yes<\/code><code>SysVStartPriority=99<\/code>&nbsp;<code>[Install]<\/code><code>WantedBy=multi-user.target<\/code><\/td><\/tr><\/tbody><\/table>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001\u521b\u5efa\u6587\u4ef6rc.local\u3000\u3000<\/p>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>1<\/td><td><code>sudo<\/code>&nbsp;<code>vi<\/code>&nbsp;<code>\/etc\/rc<\/code><code>.<\/code><code>local<\/code><\/td><\/tr><\/tbody><\/table>\n\n\n\n<p class=\"wp-block-paragraph\">4\u3001\u5c06\u4e0b\u5217\u5185\u5bb9\u590d\u5236\u8fdbrc.local\u6587\u4ef6<\/p>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>1234567891011121314<\/td><td><code>#!\/bin\/sh -e<\/code><code>#<\/code><code># rc.local<\/code><code>#<\/code><code># This script is executed at the end of each multiuser runlevel.<\/code><code># Make sure that the script will \"exit 0\" on success or any other<\/code><code># value on error.<\/code><code>#<\/code><code># In order to enable or disable this script just change the execution<\/code><code># bits.<\/code><code>#<\/code><code># By default this script does nothing.<\/code><code>echo<\/code>&nbsp;<code>\"\u770b\u5230\u8fd9\u884c\u5b57\uff0c\u8bf4\u660e\u6dfb\u52a0\u81ea\u542f\u52a8\u811a\u672c\u6210\u529f\u3002\"<\/code>&nbsp;<code>&gt;&nbsp;<\/code><code>\/usr\/local\/test<\/code><code>.log<\/code><code>exit<\/code>&nbsp;<code>0<\/code><\/td><\/tr><\/tbody><\/table>\n\n\n\n<p class=\"wp-block-paragraph\">5\u3001\u7ed9rc.local\u52a0\u4e0a\u6743\u9650<\/p>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>1<\/td><td><code>sudo<\/code>&nbsp;<code>chmod<\/code>&nbsp;<code>+x&nbsp;<\/code><code>\/etc\/rc<\/code><code>.<\/code><code>local<\/code><\/td><\/tr><\/tbody><\/table>\n\n\n\n<p class=\"wp-block-paragraph\">6\u3001\u542f\u7528\u670d\u52a1<\/p>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>1<\/td><td><code>sudo<\/code>&nbsp;<code>systemctl&nbsp;<\/code><code>enable<\/code>&nbsp;<code>rc-<\/code><code>local<\/code><\/td><\/tr><\/tbody><\/table>\n\n\n\n<p class=\"wp-block-paragraph\">7\u3001\u542f\u52a8\u670d\u52a1\u5e76\u68c0\u67e5\u72b6\u6001<\/p>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>12<\/td><td><code>sudo<\/code>&nbsp;<code>systemctl start rc-<\/code><code>local<\/code><code>.service<\/code><code>sudo<\/code>&nbsp;<code>systemctl status rc-<\/code><code>local<\/code><code>.service<\/code><\/td><\/tr><\/tbody><\/table>\n\n\n\n<p class=\"wp-block-paragraph\">8\u3001\u91cd\u542f\u5e76\u68c0\u67e5test.log\u6587\u4ef6<\/p>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>1<\/td><td><code>cat<\/code>&nbsp;<code>\/usr\/local\/test<\/code><code>.log\u3000\u3000<\/code><\/td><\/tr><\/tbody><\/table>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u80fd\u770b\u5230\u5185\u5bb9\uff0c\u8bf4\u660e\u8bbe\u7f6e\u6210\u529f\uff0c\u4f60\u5c31\u53ef\u4ee5\u901a\u8fc7\u7f16\u8f91rc.local\u6587\u4ef6\u6765\u8bbe\u7f6e\u542f\u52a8\u811a\u672c\u4e86<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8f6c\u8f7d\u81ea\uff1a https:\/\/www.cnblogs.com\/airdot\/p\/9688530.html ubun&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33],"tags":[],"class_list":["post-356","post","type-post","status-publish","format-standard","hentry","category-33"],"_links":{"self":[{"href":"https:\/\/wp.625300.xyz\/index.php?rest_route=\/wp\/v2\/posts\/356","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.625300.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.625300.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.625300.xyz\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.625300.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=356"}],"version-history":[{"count":0,"href":"https:\/\/wp.625300.xyz\/index.php?rest_route=\/wp\/v2\/posts\/356\/revisions"}],"wp:attachment":[{"href":"https:\/\/wp.625300.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=356"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.625300.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=356"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.625300.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=356"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}