rc.local用于预设一些脚本,在系统启动时候调用。而在18.04中默认没有这个文件了。解决办法很简单,先自己新建一个文件:

然后复制粘贴下边内容到文件中:

 

然后加上可执行权限:

 

还想Ubuntu 16.04一样,在exit 0前加入需要执行的代码即可。

搞定!

 

Reference:

https://vpsfix.com/community/server-administration/no-etc-rc-local-file-on-ubuntu-18-04-heres-what-to-do/

https://askubuntu.com/questions/886620/how-can-i-execute-command-on-startup-rc-local-alternative-on-ubuntu-16-10/919598#919598

 

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.