Ubuntu 19.04 /rc.local 重建手術

1.建立一個rc.local 服務

sudo nano /etc/systemd/system/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

完成後存檔記錄.

1.建立一個/etc/rc.local 檔

sudo touch /etc/rc.local
sudo chmod +x /etc/rc.local
sudo nano /etc/rc.local

加入預設的啟動SHELL內容:

#!/bin/sh -e

exit 0;

3.建立開機時的執行服務啟動

sudo systemctl enable rc-local

重新啟動電腦就完成設置了.

參考文獻

Written on December 23, 2019