新版的ubuntu开机启动时,默认不运行rc.local
systemctl status rc-local.service
如果显示code=exited, status=1/FAILURE 表示开机不运行
运行 sudo systemctl enable rc-local
如果提示
The unit files have no [Install] section.
需要重新修改rc-local.service
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
然后给/etc/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
阅读(1631) | 评论(0) | 转发(0) |