From 36c6f02c755a9536db6dffa22b5716e13d685972 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Wed, 26 Oct 2022 15:29:52 +0800 Subject: [PATCH] luci-app-ssr-plus: fix kill subprocesses Signed-off-by: Tianling Shen --- luci-app-ssr-plus/root/etc/init.d/shadowsocksr | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/luci-app-ssr-plus/root/etc/init.d/shadowsocksr b/luci-app-ssr-plus/root/etc/init.d/shadowsocksr index 845740ed5..10f62dd10 100755 --- a/luci-app-ssr-plus/root/etc/init.d/shadowsocksr +++ b/luci-app-ssr-plus/root/etc/init.d/shadowsocksr @@ -887,7 +887,13 @@ stop() { fi $PS -w | grep -v "grep" | grep ssr-monitor | awk '{print $1}' | xargs kill -9 >/dev/null 2>&1 & $PS -w | grep -v "grep" | grep "sleep 0000" | awk '{print $1}' | xargs kill -9 >/dev/null 2>&1 & - $PS -w | grep -v "grep" | grep "$TMP_PATH" | awk '{print $1}' | xargs kill -9 >/dev/null 2>&1 & + ( \ + # Graceful kill first, so programs have the chance to stop its subprocesses + $PS -w | grep -v "grep" | grep "$TMP_PATH" | awk '{print $1}' | xargs kill >/dev/null 2>&1 ; \ + sleep 3s; \ + # Force kill hanged programs + $PS -w | grep -v "grep" | grep "$TMP_PATH" | awk '{print $1}' | xargs kill -9 >/dev/null 2>&1 ; \ + ) killall -q -9 v2ray-plugin obfs-local xray-plugin rm -f /var/lock/ssr-monitor.lock if [ "$(uci -q get "dhcp.@dnsmasq[0]._unused_ssrp_changed")" = "1" ]; then @@ -897,7 +903,6 @@ stop() { uci -q rename "dhcp.@dnsmasq[0]._orig_server"="server" uci -q del "dhcp.@dnsmasq[0]._unused_ssrp_changed" uci -q commit "dhcp" - killall -9 chinadns-ng fi if [ -f "/tmp/dnsmasq.d/dnsmasq-ssrplus.conf" ]; then rm -rf /tmp/dnsmasq.d/dnsmasq-ssrplus.conf $TMP_DNSMASQ_PATH $TMP_PATH/*-ssr-*.json $TMP_PATH/ssr-server*.json