修复PID判断不精准导致获取运行状态出错的问题

This commit is contained in:
RikudouPatrickstar
2023-04-23 10:38:41 +08:00
parent ece1e280cf
commit ef57fa24a6
3 changed files with 12 additions and 12 deletions

View File

@@ -63,7 +63,7 @@ ckstatus(){
auto1="\033[36m允许\033[0mclash开机启动"
fi
#获取运行状态
PID=$(pidof clash)
PID=$(pidof $clashdir/clash)
if [ -n "$PID" ];then
run="\033[32m正在运行$redir_mod\033[0m"
VmRSS=`cat /proc/$PID/status|grep -w VmRSS|awk '{print $2,$3}'`
@@ -178,7 +178,7 @@ clashstart(){
echo -----------------------------------------------
$clashdir/start.sh start
sleep 1
[ -n "$(pidof clash)" ] && startover
[ -n "$(pidof $clashdir/clash)" ] && startover
}
checkrestart(){
echo -----------------------------------------------
@@ -1286,7 +1286,7 @@ clashcfg(){
setconfig common_ports $common_ports
}
echo -----------------------------------------------
if [ -n "$(pidof clash)" ];then
if [ -n "$(pidof $clashdir/clash)" ];then
read -p "切换时将停止clash服务是否继续(1/0) > " res
[ "$res" = 1 ] && $clashdir/start.sh stop && set_common_ports
else
@@ -1486,7 +1486,7 @@ EOF
;;
8)
source $CFG_PATH
if [ -n "$(pidof clash)" ];then
if [ -n "$(pidof $clashdir/clash)" ];then
echo -----------------------------------------------
echo -e "\033[33m检测到clash服务正在运行需要先停止clash服务\033[0m"
read -p "是否停止clash服务(1/0) > " res