diff --git a/bin/clashfm.tar.gz b/bin/clashfm.tar.gz index c04c0c1..ad838da 100644 Binary files a/bin/clashfm.tar.gz and b/bin/clashfm.tar.gz differ diff --git a/bin/version b/bin/version index f6c77a4..b791e44 100644 --- a/bin/version +++ b/bin/version @@ -1,2 +1,2 @@ GeoIP_v=20200817 -versionsh=0.9.9 +versionsh=0.9.9fix diff --git a/scripts/clash.sh b/scripts/clash.sh index 7f9ea00..dfe35b0 100644 --- a/scripts/clash.sh +++ b/scripts/clash.sh @@ -40,10 +40,10 @@ if [ -z "$redir_mod" ];then redir_mod=Redir模式 fi #获取运行状态 -status=`ps |grep -w 'clash -d'|grep -v grep|wc -l` +status=`ps |grep -w 'clash'|grep -v grep|grep -v clash.sh|wc -l` if [[ $status -gt 0 ]];then run="\033[32m正在运行($redir_mod)\033[0m" - uid=`ps |grep -w 'clash -d'|grep -v grep|awk '{print $1}'` + uid=`ps |grep -w 'clash'|grep -v grep|grep -v clash.sh|awk '{print $1}'` VmRSS=`cat /proc/$uid/status|grep -w VmRSS|awk '{print $2,$3}'` #获取运行时长 if [ -n "$start_time" ]; then @@ -86,11 +86,8 @@ if [ ! -f $clashdir/Country.mmdb ];then fi } clashstop(){ - if [ "$start_old" = "已开启" ];then - source $clashdir/start.sh && stop_old - else - /etc/init.d/clash stop > /dev/null 2>&1 - fi + source $clashdir/start.sh && stop_old + /etc/init.d/clash stop > /dev/null 2>&1 } clashstart(){ if [ ! -f "$yaml" ];then @@ -107,7 +104,7 @@ clashstart(){ if [ "$start_old" = "已开启" ];then source $clashdir/start.sh && start_old sleep 1 - status=`ps |grep -w 'clash -d'|grep -v grep` + status=`ps |grep -w 'clash'|grep -v grep|grep -v clash.sh` if [ -z "$status" ];then echo -e "\033[31mclash启动失败!\033[0m" sed -i /start_old=*/d $ccfg @@ -116,12 +113,12 @@ clashstart(){ else /etc/init.d/clash start sleep 1 - status=`ps |grep -w 'clash -d'|grep -v grep` + status=`ps |grep -w 'clash'|grep -v grep|grep -v clash.sh` if [ -z "$status" ];then echo -e "\033[31mclash启动失败!尝试使用保守方式启动!\033[0m" source $clashdir/start.sh && start_old sleep 1 - status=`ps |grep -w 'clash -d'|grep -v grep` + status=`ps |grep -w 'clash'|grep -v grep|grep -v clash.sh` if [ -z "$status" ];then echo -e "\033[31mclash启动失败!\033[0m" sed -i /start_old=*/d $ccfg diff --git a/scripts/getdate.sh b/scripts/getdate.sh index e790217..3f1c760 100644 --- a/scripts/getdate.sh +++ b/scripts/getdate.sh @@ -94,26 +94,8 @@ else mv $yamlnew $yaml echo 配置文件已生成!正在启动clash使其生效! #重启clash服务 - if [ $status -gt 0 ];then - echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - killall -9 clash &> /dev/null - echo -e "\033[31mClash服务已停止!\033[0m" - fi - echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - if [ "$start_old" = "已开启" ];then - source $clashdir/start.sh && start_old - else - /etc/init.d/clash start - sleep 1 - status=`ps |grep -w 'clash -d'|grep -v grep` - if [ -z "$status" ];then - echo -e "\033[31mclash启动失败!尝试使用保守方式启动!\033[0m" - source $clashdir/start.sh && start_old - fi - fi - sleep 1 - status=`ps |grep -w 'clash -d'|grep -v grep|wc -l` - if [[ $status -gt 0 ]];then + killall -9 clash &> /dev/null + start_over(){ host=$(ubus call network.interface.lan status | grep \"address\" | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}';) echo -e "\033[32mclash服务已启动!\033[0m" echo -e "可以使用\033[30;47m http://clash.razord.top \033[0m管理内置规则" @@ -121,7 +103,29 @@ else echo -e "也可前往更新菜单安装本地Dashboard面板,连接更稳定!\033[0m" echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ clashsh + } + if [ "$start_old" = "已开启" ];then + source $clashdir/start.sh && start_old + sleep 1 + status=`ps |grep -w 'clash'|grep -v grep|grep -v clash.sh|wc -l` + if [[ $status -gt 0 ]];then + start_over + fi else + /etc/init.d/clash start + sleep 1 + status=`ps |grep -w 'clash'|grep -v grep|grep -v clash.sh|wc -l` + if [[ $status -gt 0 ]];then + start_over + else + echo -e "\033[31mclash服务启动失败!尝试使用保守方式启动!\033[0m" + source $clashdir/start.sh && start_old + sleep 1 + status=`ps |grep -w 'clash'|grep -v grep|grep -v clash.sh|wc -l` + if [[ $status -gt 0 ]];then + start_over + fi + fi echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if [ -f $yaml.bak ];then echo -e "\033[31mclash服务启动失败!已还原配置文件并重启clash!\033[0m" diff --git a/scripts/start.sh b/scripts/start.sh index 00738e8..82d8341 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -143,7 +143,7 @@ start_dns(){ } daemon_old(){ #守护进程状态 - status=$(ps |grep -w 'clash -d'|grep -v grep) + status=$(ps |grep -w 'clash'|grep -v grep|grep -v clash.sh) [ -z $status ] && $clashdir/clash -d $clashdir && mark_time } checkcron(){