Ubuntu18+:
这是要启动的脚本:
/usr/local/start.sh
给权限:
chmod +x start.sh
进入:/etc/systemd/system/
创建test.service 文件:
[Unit]
Description=test(简介)
After=xxx.service xxxx.service (哪个 service之后)
[Service]
ExecStart=/usr/local/start.sh
[Install]
WantedBy=multi-user.target
文件改动要reload
sudo systemctl daemon-reload service
设置开机启动
sudo systemctl enable test.service
Debian9:
创建脚本:nano /root/test.sh
在nano /root/.bashrc 末尾添加:
cd /root
./test.sh