用到了 rc.local
在最下面添加
- [Install]
- WantedBy=multi-user.target

- cd /etc
- vi rc.local
-
- 在里面写入 /opt/start.sh
- chmod +x /etc/rc.local # 添加可执行权限
- chmod +x /opt/start.sh # 添加可执行权限
-
- systemctl start rc-local # 启动rc-local服务
- systemctl status rc-local # 查看状态
- systemctl enable rc-local # 加入开机自启
启动发现报错

修改 /etc/rc.local ,首行加上(必须)
#!/bin/bash

再次启动就正常
