最近把家裡的centos 7伺服器改成了新19.04版本的,但是發現完全找不到開機執行的RC.LOCAL 檔,只好自行重建了
1.建立一個rc.local 服務
sudo vi /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 vi /etc/rc.local
加入預設的啟動SHELL內容:
#!/bin/sh -e
exit 0;
3.建立開機時的執行服務啟動
sudo systemctl enable rc-local
重新啟動電腦就完成設置了.