新增clash管理脚本

This commit is contained in:
juewuy
2020-07-23 14:44:53 +08:00
parent 2346d0ccb9
commit c8cfc93b60
3 changed files with 136 additions and 25 deletions
+8 -23
View File
@@ -3,6 +3,7 @@
=====
PS
--
•新增了管理脚本,按照完成后执行clash命令即可使用脚本!之前版本安装的用户可以将clashservice和clashsh两个文件上传到etc/clash下后重新执行安装命令即可使用<br>
•新增了redir模式,redir模式速度更快但是不支持UDP转发;tun模式支持UDP转发,但CPU和内存占用相对更高,请根据需求选择<br>
•支持ss,v2ray,trojan,但不支持ssr,也不支持订阅<br>
•需要自行编辑config.yaml以配置服务器<br>
@@ -23,34 +24,18 @@ PS
*·如有必要,也可以自行前往下载更新clash核心文件并自行改名 https://github.com/Dreamacro/clash/releases/tag/premium (小米AX3600是armv8ax1800/ax5是armv7,其他路由器请自查)<br>*
•将下载并修改后的4个文件通过winSCP上传到路由器/etc/clash文件夹(clash文件夹请自行创建)下(最终应该是/etc/clash/"4个文件"<br>
•登陆SSH,并在SSH中用root用户执行下方的**对应命令**即可使用!<br>
**首次安装clash**
**首次安装**
```Shell
mv /etc/clash/clashservice /etc/init.d/clash #clash服务文件移动到系统目录
mv /etc/clash/clashservice /etc/init.d/clash #移动clash服务文件
mv /etc/clash/clashsh /bin/clash #移动clash管理脚本
chmod 777 /etc/clash/clash #授予权限
chmod 777 /etc/init.d/clash #授予权限
service clash enable #启用clash开机启动
service clash start #启动clash服务
chmod 777 /bin/clash #授予权限
clash #使用管理脚本
```
**停止clash**
**管理脚本**
```Shell
service clash stop #停止clash服务
```
**启用clash**
```Shell
service clash start #启动clash服务
```
**设置clash开机启动**
```Shell
service clash enable #启用clash开机启动
```
**禁止clash开机启动**
```Shell
service clash disable #禁止clash开机启动
```
**卸载clash相关文件**
```Shell
rm -rf /etc/clash #删除clash文件夹及文件
rm /etc/init.d/clash #删除clash开机启动文件
clash #使用管理脚本
```
•启用后可以通过 http://clash.razord.top IP为网关IP,端口为9999)管理clash内置规则<br>
+63
View File
@@ -0,0 +1,63 @@
#!/bin/sh
# Copyright (C) 2006-2011 OpenWrt.org
echo "***********************************************"
echo "** 欢迎使用 **"
echo "** Clash for Miwifi **"
echo "** by Juewuy **"
echo "***********************************************"
echo 1 启动clash服务
echo 2 重启clash服务
echo 3 停止clash服务
echo 4 设置clash开机启动
echo 5 禁止clash开机启动
echo 6 卸载clash相关文件(慎用!)
echo 0 退出脚本
read -p "请输入对应数字>" num
if [[ $num == 0 ]]; then
exit;
elif [[ $num == 1 ]]; then
/etc/init.d/clash start
echo clash服务已启动!
echo 可以使用 http://clash.razord.top IP为网关IP,端口为9999)管理clash内置规则
exit;
elif [[ $num == 2 ]]; then
/etc/init.d/clash stop
/etc/init.d/clash start
echo clash服务已启动!
echo 可以使用 http://clash.razord.top IP为网关IP,端口为9999)管理clash内置规则
exit;
elif [[ $num == 3 ]]; then
/etc/init.d/clash stop
echo clash服务已停止!
exit;
elif [[ $num == 4 ]]; then
/etc/init.d/clash enable
echo 已设置clash开机启动!
exit;
elif [[ $num == 5 ]]; then
/etc/init.d/clash disable
echo 已禁止clash开机启动!
exit;
elif [[ $num == 6 ]]; then
read -p "确认卸载clash[1/0] " res
if [ "$res" = '1' ]; then
/etc/init.d/clash disable
/etc/init.d/clash stop
rm -rf /etc/clash
rm /etc/init.d/clash
rm /bin/clash
echo 已卸载clash相关文件!
fi
exit;
else
echo 请输入正确的数字!
fi
exit 1
+63
View File
@@ -0,0 +1,63 @@
#!/bin/sh
# Copyright (C) 2006-2011 OpenWrt.org
echo "***********************************************"
echo "** 欢迎使用 **"
echo "** Clash for Miwifi **"
echo "** by Juewuy **"
echo "***********************************************"
echo 1 启动clash服务
echo 2 重启clash服务
echo 3 停止clash服务
echo 4 设置clash开机启动
echo 5 禁止clash开机启动
echo 6 卸载clash相关文件(慎用!)
echo 0 退出脚本
read -p "请输入对应数字>" num
if [[ $num == 0 ]]; then
exit;
elif [[ $num == 1 ]]; then
/etc/init.d/clash start
echo clash服务已启动!
echo 可以使用 http://clash.razord.top IP为网关IP,端口为9999)管理clash内置规则
exit;
elif [[ $num == 2 ]]; then
/etc/init.d/clash stop
/etc/init.d/clash start
echo clash服务已启动!
echo 可以使用 http://clash.razord.top IP为网关IP,端口为9999)管理clash内置规则
exit;
elif [[ $num == 3 ]]; then
/etc/init.d/clash stop
echo clash服务已停止!
exit;
elif [[ $num == 4 ]]; then
/etc/init.d/clash enable
echo 已设置clash开机启动!
exit;
elif [[ $num == 5 ]]; then
/etc/init.d/clash disable
echo 已禁止clash开机启动!
exit;
elif [[ $num == 6 ]]; then
read -p "确认卸载clash[1/0] " res
if [ "$res" = '1' ]; then
/etc/init.d/clash disable
/etc/init.d/clash stop
rm -rf /etc/clash
rm /etc/init.d/clash
rm /bin/clash
echo 已卸载clash相关文件!
fi
exit;
else
echo 请输入正确的数字!
fi
exit 1