fix(openwrt): Replace pgrep -x with pgrep for BusyBox compatibility
The -x flag requires exact process name match which doesn't work reliably on OpenWrt/BusyBox. Removed -x from all pgrep calls in: - luci-app-bandwidth-manager - luci-app-secubox-security-threats - luci-app-auth-guardian - luci-app-media-flow - luci-app-vhost-manager - luci-app-network-modes Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
a602462915
commit
13d7e8641f
@ -105,7 +105,9 @@
|
||||
"Bash(./staging_dir/host/bin/ipkg-build:*)",
|
||||
"Bash(./scripts/ipkg-build:*)",
|
||||
"WebFetch(domain:hub.docker.com)",
|
||||
"WebFetch(domain:localai.io)"
|
||||
"WebFetch(domain:localai.io)",
|
||||
"WebFetch(domain:downloads.lms-community.org)",
|
||||
"Bash(./secubox-tools/sdk/build-package.sh:*)"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ status() {
|
||||
|
||||
# Check nodogsplash
|
||||
local captive_portal=0
|
||||
pgrep -x nodogsplash >/dev/null 2>&1 && captive_portal=1
|
||||
pgrep nodogsplash >/dev/null 2>&1 && captive_portal=1
|
||||
json_add_boolean "captive_portal_active" "$captive_portal"
|
||||
|
||||
json_dump
|
||||
|
||||
@ -591,7 +591,7 @@ get_dpi_applications() {
|
||||
json_init
|
||||
json_add_array "applications"
|
||||
|
||||
if [ -f "$NDPID_FLOWS" ] && pgrep -x ndpid >/dev/null 2>&1; then
|
||||
if [ -f "$NDPID_FLOWS" ] && pgrep ndpid >/dev/null 2>&1; then
|
||||
# Extract unique applications from nDPId flows
|
||||
jq -r '.flows[]? | .app // "Unknown"' "$NDPID_FLOWS" 2>/dev/null | sort -u | while read app; do
|
||||
[ -z "$app" ] && continue
|
||||
@ -610,9 +610,9 @@ get_dpi_applications() {
|
||||
|
||||
# Check DPI source status
|
||||
local dpi_source="none"
|
||||
if [ -f "$NDPID_FLOWS" ] && pgrep -x ndpid >/dev/null 2>&1; then
|
||||
if [ -f "$NDPID_FLOWS" ] && pgrep ndpid >/dev/null 2>&1; then
|
||||
dpi_source="ndpid"
|
||||
elif [ -f "/var/run/netifyd/status.json" ] && pgrep -x netifyd >/dev/null 2>&1; then
|
||||
elif [ -f "/var/run/netifyd/status.json" ] && pgrep netifyd >/dev/null 2>&1; then
|
||||
dpi_source="netifyd"
|
||||
fi
|
||||
json_add_string "dpi_source" "$dpi_source"
|
||||
|
||||
@ -98,13 +98,13 @@ status() {
|
||||
echo "UCI enabled: $enabled"
|
||||
|
||||
# DPI engine status
|
||||
if pgrep -x ndpid >/dev/null 2>&1; then
|
||||
if pgrep ndpid >/dev/null 2>&1; then
|
||||
echo "nDPId: Running"
|
||||
else
|
||||
echo "nDPId: Not running"
|
||||
fi
|
||||
|
||||
if pgrep -x netifyd >/dev/null 2>&1; then
|
||||
if pgrep netifyd >/dev/null 2>&1; then
|
||||
echo "Netifyd: Running"
|
||||
else
|
||||
echo "Netifyd: Not running"
|
||||
|
||||
@ -27,7 +27,7 @@ enabled=$(uci -q get media_flow.global.enabled 2>/dev/null || echo "1")
|
||||
[ "$enabled" != "1" ] && exit 0
|
||||
|
||||
# Check if netifyd is running
|
||||
pgrep -x netifyd > /dev/null 2>&1 || exit 0
|
||||
pgrep netifyd > /dev/null 2>&1 || exit 0
|
||||
|
||||
# Initialize history file
|
||||
[ ! -f "$HISTORY_FILE" ] && echo '[]' > "$HISTORY_FILE"
|
||||
|
||||
@ -80,11 +80,11 @@ get_status() {
|
||||
|
||||
# Services status
|
||||
json_add_object "services"
|
||||
json_add_boolean "firewall" "$(pgrep -x fw4 >/dev/null && echo 1 || echo 0)"
|
||||
json_add_boolean "dnsmasq" "$(pgrep -x dnsmasq >/dev/null && echo 1 || echo 0)"
|
||||
json_add_boolean "netifyd" "$(pgrep -x netifyd >/dev/null && echo 1 || echo 0)"
|
||||
json_add_boolean "nginx" "$(pgrep -x nginx >/dev/null && echo 1 || echo 0)"
|
||||
json_add_boolean "squid" "$(pgrep -x squid >/dev/null && echo 1 || echo 0)"
|
||||
json_add_boolean "firewall" "$(pgrep fw4 >/dev/null && echo 1 || echo 0)"
|
||||
json_add_boolean "dnsmasq" "$(pgrep dnsmasq >/dev/null && echo 1 || echo 0)"
|
||||
json_add_boolean "netifyd" "$(pgrep netifyd >/dev/null && echo 1 || echo 0)"
|
||||
json_add_boolean "nginx" "$(pgrep nginx >/dev/null && echo 1 || echo 0)"
|
||||
json_add_boolean "squid" "$(pgrep squid >/dev/null && echo 1 || echo 0)"
|
||||
json_close_object
|
||||
|
||||
json_dump
|
||||
@ -192,7 +192,7 @@ get_sniffer_config() {
|
||||
|
||||
# Netifyd status
|
||||
local netifyd_running=0
|
||||
pgrep -x netifyd >/dev/null && netifyd_running=1
|
||||
pgrep netifyd >/dev/null && netifyd_running=1
|
||||
json_add_boolean "netifyd_running" "$netifyd_running"
|
||||
|
||||
# Sample config preview
|
||||
|
||||
@ -339,7 +339,7 @@ case "$1" in
|
||||
json_add_boolean "enabled" 1
|
||||
json_add_string "module" "secubox-security-threats"
|
||||
json_add_string "version" "1.0.0"
|
||||
json_add_boolean "netifyd_running" $(pgrep -x netifyd >/dev/null && echo 1 || echo 0)
|
||||
json_add_boolean "netifyd_running" $(pgrep netifyd >/dev/null && echo 1 || echo 0)
|
||||
json_add_boolean "crowdsec_running" $(pgrep crowdsec >/dev/null && echo 1 || echo 0)
|
||||
json_add_boolean "cscli_available" $([ -x "$CSCLI" ] && echo 1 || echo 0)
|
||||
json_dump
|
||||
|
||||
@ -486,7 +486,7 @@ case "$1" in
|
||||
json_add_boolean "enabled" 1
|
||||
json_add_string "module" "vhost-manager"
|
||||
json_add_string "version" "$PKG_VERSION"
|
||||
if pgrep -x nginx >/dev/null 2>&1; then
|
||||
if pgrep nginx >/dev/null 2>&1; then
|
||||
json_add_boolean "nginx_running" 1
|
||||
json_add_string "nginx_version" "$(nginx -v 2>&1 | grep -o 'nginx/[0-9.]*' | cut -d'/' -f2)"
|
||||
else
|
||||
|
||||
Loading…
Reference in New Issue
Block a user