Fix router stop action and center status cards
This commit is contained in:
1 parent
dca910b43e
commit
13290bf8ab
3 files changed
+66
-8
No files matched your search
@@ -18,6 +18,7 @@ usage() {
|
||||
owrt-remote status
|
||||
owrt-remote doctor
|
||||
owrt-remote install-xray-tmp
|
||||
owrt-remote stop-xray
|
||||
owrt-remote render-client [--stdout]
|
||||
owrt-remote run
|
||||
owrt-remote heartbeat
|
||||
@@ -184,6 +185,32 @@ xray_running() {
|
||||
ps_all | grep '[x]ray' | grep -F "$config" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
stop_xray() {
|
||||
local config pids pid alive
|
||||
config="$(uci_get xray_config /etc/xray/owrt-remote-client.json)"
|
||||
pids="$(ps_all | grep '[x]ray' | grep -F "$config" | awk '{print $1}')"
|
||||
if [ -z "$pids" ]; then
|
||||
printf '%s\n' "OK: Xray уже остановлен"
|
||||
return 0
|
||||
fi
|
||||
for pid in $pids; do
|
||||
kill "$pid" >/dev/null 2>&1 || true
|
||||
done
|
||||
sleep 1
|
||||
alive=""
|
||||
for pid in $pids; do
|
||||
if kill -0 "$pid" >/dev/null 2>&1; then
|
||||
kill -9 "$pid" >/dev/null 2>&1 || true
|
||||
alive="$alive $pid"
|
||||
fi
|
||||
done
|
||||
if [ -n "$alive" ]; then
|
||||
printf 'OK: Xray остановлен принудительно:%s\n' "$alive"
|
||||
else
|
||||
printf '%s\n' "OK: Xray остановлен"
|
||||
fi
|
||||
}
|
||||
|
||||
ssh_running() {
|
||||
ps_all | grep '[d]ropbear' >/dev/null 2>&1
|
||||
}
|
||||
@@ -608,6 +635,9 @@ case "$cmd" in
|
||||
install-xray-tmp)
|
||||
install_xray_tmp
|
||||
;;
|
||||
stop-xray)
|
||||
stop_xray
|
||||
;;
|
||||
render-client)
|
||||
render_client_config "$@"
|
||||
;;
|
||||
|
||||
Reference in new issue
Block a user