@大法师 谢谢!搞定了
ubuntu 20没有/etc/rc.local,需要
- 新建service
sudo vim /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
2.使能service
sudo systemctl enable rc-local.service
3.新建/etc/rc.local
sudo vim /etc/rc.local
并需要操作的命令加进去
4.启动服务
sudo systemctl start rc-local.service
sudo systemctl status rc-local.service