# 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
```