1. Modify rc-local.service
sudo vim /etc/systemd/system/rc-local.service
add content
[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. Activate service
sudo systemctl enable rc-local.service
3. Modify the rc.local file, add it if it does not exist, and grant permissions
sudo touch /etc/rc.local
sudo chmod 777 /etc/rc.local
gedit /etc/rc.local
add content
#!/bin/sh -e
#开机自启程序的运行命令,注意:不会自动结束的程序,必须加 & 表示在后台运行
/home/work/Documents/build-SDK-Desktop-Debug/SDK &
exit 0