Sync stopped router status on hub
This commit is contained in:
1 parent
deb82b6104
commit
a14ffeaf4a
4 files changed
+44
-12
No files matched your search
@@ -23,10 +23,26 @@ config_enabled() {
|
||||
esac
|
||||
}
|
||||
|
||||
stop_xray_processes() {
|
||||
local config pids pid
|
||||
xray_pids() {
|
||||
local config cmdline cmd pid
|
||||
config="$(uci_get xray_config /etc/xray/owrt-remote-client.json)"
|
||||
pids="$( (ps w 2>/dev/null || ps 2>/dev/null) | grep '[x]ray' | grep -F "$config" | awk '{print $1}')"
|
||||
[ -n "$config" ] || return 0
|
||||
for cmdline in /proc/[0-9]*/cmdline; do
|
||||
[ -r "$cmdline" ] || continue
|
||||
cmd="$(tr '\000' ' ' <"$cmdline" 2>/dev/null || true)"
|
||||
case "$cmd" in
|
||||
*xray*"$config"*|*xray-core*"$config"*)
|
||||
pid="${cmdline%/cmdline}"
|
||||
pid="${pid##*/}"
|
||||
printf '%s\n' "$pid"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
stop_xray_processes() {
|
||||
local pids pid
|
||||
pids="$(xray_pids)"
|
||||
for pid in $pids; do
|
||||
kill "$pid" >/dev/null 2>&1 || true
|
||||
done
|
||||
|
||||
@@ -179,16 +179,30 @@ ps_all() {
|
||||
ps w 2>/dev/null || ps 2>/dev/null || true
|
||||
}
|
||||
|
||||
xray_running() {
|
||||
local config
|
||||
xray_pids() {
|
||||
local config cmdline cmd pid
|
||||
config="$(uci_get xray_config /etc/xray/owrt-remote-client.json)"
|
||||
ps_all | grep '[x]ray' | grep -F "$config" >/dev/null 2>&1
|
||||
[ -n "$config" ] || return 0
|
||||
for cmdline in /proc/[0-9]*/cmdline; do
|
||||
[ -r "$cmdline" ] || continue
|
||||
cmd="$(tr '\000' ' ' <"$cmdline" 2>/dev/null || true)"
|
||||
case "$cmd" in
|
||||
*xray*"$config"*|*xray-core*"$config"*)
|
||||
pid="${cmdline%/cmdline}"
|
||||
pid="${pid##*/}"
|
||||
printf '%s\n' "$pid"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
xray_running() {
|
||||
[ -n "$(xray_pids)" ]
|
||||
}
|
||||
|
||||
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}')"
|
||||
local pids pid alive
|
||||
pids="$(xray_pids)"
|
||||
if [ -z "$pids" ]; then
|
||||
printf '%s\n' "OK: Xray уже остановлен"
|
||||
return 0
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
KEY_FILE="${KEY_FILE:-/etc/owrt-remote/web.key}"
|
||||
AGENT="${AGENT:-/usr/sbin/owrt-remote}"
|
||||
OWRT_REMOTE_UI_VERSION="2026-06-30-init-ash-fix-v20"
|
||||
OWRT_REMOTE_UI_VERSION="2026-06-30-stop-sync-v21"
|
||||
PARAMS_FILE="${TMPDIR:-/tmp}/owrt-remote-cgi.$$"
|
||||
RESULT_TITLE=""
|
||||
RESULT_BODY=""
|
||||
@@ -190,6 +190,7 @@ run_action() {
|
||||
/etc/init.d/owrt-remote stop >>"$output" 2>&1 || rc=$?
|
||||
"$AGENT" stop-xray >>"$output" 2>&1 || rc=$?
|
||||
/etc/init.d/owrt-remote disable >>"$output" 2>&1 || rc=$?
|
||||
"$AGENT" heartbeat >>"$output" 2>&1 || true
|
||||
set_result "Сервис остановлен" "$(cat "$output")" "warn"
|
||||
;;
|
||||
restart)
|
||||
|
||||
Reference in new issue
Block a user