note/tech/naiveproxy开关.md
2025-11-19 10:16:05 +08:00

30 lines
615 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# naiveproxy开关
```bash
#!/bin/sh
#获取当前脚本文件路径
shellPath=$(cd "$(dirname "$0")"; pwd)
cd $shellPath
#是否存在naive,1099端口是否被占用
i=3
while [ $i -gt 0 ]
do
if lsof -i:1099 >/dev/null; then
if pgrep -x "naive" > /dev/null; then
echo "naive 程序在运行。"
exit 0
else
echo "1099端口被占用naive无法启动。"
exit 1
fi
else
# 开始启动naive
echo "开始启动naive 代理..."
./naive config.json --log=access.log 2>&1 &
sleep 2
fi
i=`expr $i - 1`
done
echo "启动naive失败未知错误。"
exit 1
```