2个sing-box配置服务形式启动
使用 systemd
管理服务(推荐)
创建 systemd
服务文件
服务文件 1:sudo nano /etc/systemd/system/sing-box-8585.service
[Unit]
Description=sing-box 8585 Service
After=network.target
[Service]
ExecStart=/usr/local/bin/sing-box run -c /etc/sing-box/8585.json
Restart=on-failure
User=nobody
Group=nogroup
[Install]
WantedBy=multi-user.target
服务文件 2:sudo nano /etc/systemd/system/sing-box-1080.service
[Unit]
Description=sing-box 1080 Service
After=network.target
[Service]
ExecStart=/usr/local/bin/sing-box run -c /etc/sing-box/1080.json
Restart=on-failure
User=nobody
Group=nogroup
[Install]
WantedBy=multi-user.target
启用并启动服务
bash
# 重新加载 systemd 配置
sudo systemctl daemon-reload
# 启用服务
sudo systemctl enable sing-box-8585
sudo systemctl enable sing-box-1080
# 启动服务
sudo systemctl start sing-box-8585
sudo systemctl start sing-box-1080
检查服务状态
sudo systemctl status sing-box-8585
sudo systemctl status sing-box-1080
停止服务
sudo systemctl stop sing-box-8585
sudo systemctl stop sing-box-1080
禁用服务
sudo systemctl disable sing-box-8585
sudo systemctl disable sing-box-1080
本文是原创文章,采用 CC BY-NC-ND 4.0 协议,完整转载请注明来自 程序员小航
评论
匿名评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果