Optimize the system proxy opening method.
This commit is contained in:
parent
e289381339
commit
2d533ecb1e
19
README.md
19
README.md
|
@ -39,16 +39,22 @@ $ cd clash-for-linux
|
|||
|
||||
```bash
|
||||
$ sh start.sh
|
||||
Clash订阅地址可访问! [ OK ]
|
||||
配置文件config.yaml下载成功! [ OK ]
|
||||
服务启动成功! [ OK ]
|
||||
系统代理http_proxy/https_proxy设置成功,请在当前窗口执行以下命令加载环境变量:
|
||||
|
||||
source /etc/profile.d/clash.sh
|
||||
Clash Dashboard 访问地址:http://IP:9090/ui
|
||||
Secret:xxxxxxxxxxxxx
|
||||
|
||||
请执行以下命令加载环境变量: source /etc/profile.d/clash.sh
|
||||
|
||||
请执行以下命令开启系统代理: proxy_on
|
||||
|
||||
```
|
||||
|
||||
```bash
|
||||
$ source /etc/profile.d/clash.sh
|
||||
$ proxy_on
|
||||
```
|
||||
|
||||
- 检查服务端口
|
||||
|
@ -86,14 +92,13 @@ $ cd clash-for-linux
|
|||
|
||||
```bash
|
||||
$ sh shutdown.sh
|
||||
服务关闭成功,请在已打开的窗口执行以下命令:
|
||||
unset http_proxy
|
||||
unset https_proxy
|
||||
|
||||
服务关闭成功,请执行以下命令关闭系统代理:proxy_off
|
||||
|
||||
```
|
||||
|
||||
```bash
|
||||
$ unset http_proxy
|
||||
$ unset https_proxy
|
||||
$ proxy_off
|
||||
```
|
||||
|
||||
然后检查程序端口、进程以及环境变量`http_proxy|https_proxy`,若都没则说明服务正常关闭。
|
||||
|
|
|
@ -11,4 +11,4 @@ fi
|
|||
# 清除环境变量
|
||||
> /etc/profile.d/clash.sh
|
||||
|
||||
echo -e "服务关闭成功,请在已打开的窗口执行以下命令:\nunset http_proxy\nunset https_proxy\nunset no_proxy"
|
||||
echo -e "\n服务关闭成功,请执行以下命令关闭系统代理:proxy_off\n"
|
||||
|
|
23
start.sh
23
start.sh
|
@ -100,5 +100,24 @@ echo -e "Secret:${Secret}"
|
|||
echo ''
|
||||
|
||||
# 添加环境变量(root权限)
|
||||
echo -e "export http_proxy=http://127.0.0.1:7890\nexport https_proxy=http://127.0.0.1:7890\nexport no_proxy=127.0.0.1,localhost" > /etc/profile.d/clash.sh
|
||||
echo -e "系统代理http_proxy/https_proxy/no_proxy设置成功,请在当前窗口执行以下命令加载环境变量:\n\nsource /etc/profile.d/clash.sh\n"
|
||||
cat>/etc/profile.d/clash.sh<<EOF
|
||||
# 开启系统代理
|
||||
function proxy_on() {
|
||||
export http_proxy=http://127.0.0.1:7890
|
||||
export https_proxy=http://127.0.0.1:7890
|
||||
export no_proxy=127.0.0.1,localhost
|
||||
echo -e "\033[32m[√] 已开启代理\033[0m"
|
||||
}
|
||||
|
||||
# 关闭系统代理
|
||||
function proxy_off(){
|
||||
unset http_proxy
|
||||
unset https_proxy
|
||||
unset no_proxy
|
||||
echo -e "\033[31m[×] 已关闭代理\033[0m"
|
||||
}
|
||||
EOF
|
||||
|
||||
echo -e "请执行以下命令加载环境变量: source /etc/profile.d/clash.sh\n"
|
||||
echo -e "请执行以下命令开启系统代理: proxy_on\n"
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user