配置rc-local
1.首先创建systemd的服务脚本
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
2.创建脚本
sudo touch /etc/rc.local
chmod 755 /etc/rc.local
sudo echo "#!/bin/bash" > /etc/rc.local
3.加入系统服务
systemctl enable rc-local.service