File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,7 +46,8 @@ if is_sing_box_running; then
4646 fi
4747else
4848 log " INFO" " 检测到 sing-box 未运行,准备执行启动操作..."
49- if sh " $SERVICE_SCRIPT " start; then
49+ # su 包裹:让 sing-box 迁出冻结 cgroup,避免切后台断网
50+ if su -c " sh \" $SERVICE_SCRIPT \" start" ; then
5051 echo " ==================================="
5152 echo " 操作结果: NetProxy 服务已启动"
5253 echo " ==================================="
Original file line number Diff line number Diff line change @@ -290,7 +290,8 @@ sync_to_live() {
290290restart_proxy_if_needed () {
291291 if [ " $PROXY_WAS_RUNNING " = true ]; then
292292 print_step " 重新启动代理服务..."
293- sh " $LIVE_DIR /scripts/core/service.sh" start > /dev/null 2>&1
293+ # su 包裹:经管理器刷入时让 sing-box 迁出冻结 cgroup,避免切后台断网
294+ su -c " sh \" $LIVE_DIR /scripts/core/service.sh\" start" > /dev/null 2>&1
294295 print_ok " 服务已启动"
295296 fi
296297
Original file line number Diff line number Diff line change @@ -44,7 +44,8 @@ is_service_running() {
4444restart_service_if_allowed () {
4545 if [ " $SWITCH_ALLOW_RESTART " = " 1" ]; then
4646 log " DEBUG" " 回退方式:重启核心服务以应用配置"
47- LOG_STDERR=0 LOG_LEVEL=WARN sh " $SERVICE_SCRIPT " restart core || die " 重启 sing-box 服务失败"
47+ # su 包裹:让重启拉起的 sing-box 迁出冻结 cgroup (LOG_* 写入命令串内)
48+ su -c " LOG_STDERR=0 LOG_LEVEL=WARN sh \" $SERVICE_SCRIPT \" restart core" || die " 重启 sing-box 服务失败"
4849 else
4950 log " WARN" " 当前阶段不允许通过重启应用配置"
5051 return 1
You can’t perform that action at this time.
0 commit comments