Skip to content

Commit e51de93

Browse files
committed
fix(service): prepare_singbox 先进入到配置文件目录再进行 check -c,以避免检查配置时遇到相对路径报错的问题
1 parent 334be91 commit e51de93

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

box/scripts/box.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ prepare_singbox() {
214214
${yq} '.log.output = "'"${box_run}/${bin_name}.log"'"' -i --output-format=json "${sing_config}" 2>/dev/null || true
215215

216216
# 检查 sing-box 配置
217-
if ${bin_path} check -c "${sing_config}" > "${box_run}/${bin_name}.log" 2>&1; then
217+
if ( cd "$(dirname "${sing_config}")" && "${bin_path}" check -c "$(basename "${sing_config}")" ) > "${box_run}/${bin_name}.log" 2>&1; then
218218
# 根据 network_mode 设置 auto_route
219219
if [[ "${network_mode}" == @(mixed|tun) ]]; then
220220
# 检查配置中是否有 "type": "tun"

0 commit comments

Comments
 (0)