哇vim
這個真的難受spa
找了半天的方案不能用code
專門加入18.04關鍵字才找到的blog
好氣啊ip
之後更新新版本這個方法可能也就不能用了get
查東西時記得加入系統版本號關鍵詞it
咱也不懂原理io
只能從別人那裏把步驟摘過來class
一、創建rc-local.service文件
原理
sudo vim /etc/systemd/system/rc-local.service
二、將下列內容複製進rc-local.service文件
[Unit] Description=/etc/rc.local Compatibility ConditionPathExists=/etc/rc.local [Service] Type=forking ExecStart=/etc/rc.local start TimeoutSec=0 StandardOutput=tty RemainAfterExit=yes SysVStartPriority=99 [Install] WantedBy=multi-user.target
三、建立文件rc.localsudo
sudo vim /etc/rc.local
四、編輯rc.local文件
#!/bin/sh -e # 這個地方寫要開機自動啓動的腳本或命令 exit 0
五、給rc.local加上權限sudo chmod +x /etc/rc.local六、啓用服務sudo systemctl enable rc-local七、啓動服務並檢查狀態
sudo systemctl start rc-local.service sudo systemctl status rc-local.service
爽啦!