宝塔自启动.md 678 B


notion-id: 280ca4d7-cb7b-8068-a110-c61cf6fcb9

先检查:

systemctl status bt.service

你可以用 systemd 的 service 文件来包装它。新建文件:

sudo nano /etc/systemd/system/bt.service

写入:

[Unit]
Description=BT Panel
After=network.target

[Service]
Type=forking
ExecStart=/etc/init.d/bt start
ExecStop=/etc/init.d/bt stop
ExecReload=/etc/init.d/bt restart
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

保存后执行:

sudo systemctl daemon-reload        # 让systemd重新加载
sudo systemctl enable bt.service    # 设置开机自启
sudo systemctl start bt.service     # 立即启动