Article 5QXSG check this for mistake

check this for mistake

by
kaempfer1968
from LinuxQuestions.org on (#5QXSG)
In the web I have found a script called "Autosuspend".

I'm no programmer. But it is my understanding that the part of the script below looks for active clients on port 9981 and 9982.
Though I have one or more active clients on port 9982 the variable "$active_clients" never gets TRUE.
Can someone tell me if there is a mistake in this part of the script.

The script is running on Linux Mint 20.

Here is the part of the script that is not working

TVHEADEND_IP=$(echo ${TVHEADEND_IP:-$(hostname -I)} | tr -d [:space:])
TVHEADEND_HTTP_PORT=${TVHEADEND_HTTP_PORT:-9981}
TVHEADEND_HTSP_PORT=${TVHEADEND_HTSP_PORT:-9982}

TVHEADEND_PORTS="$TVHEADEND_HTTP_PORT $TVHEADEND_HTSP_PORT"
LANG=C
active_clients=()
for port in $TVHEADEND_PORTS; do
IFS=$'\n' active_clients+=($(netstat -n | grep -oP "$TVHEADEND_IP:$port\s+\K([^\s]+)(?=:\d+\s+ESTABLISHED)"))
done
if [ $active_clients ]; then
logit "Tvheadend has active clients: ${active_clients[@]}"
return 1
filatest?d=yIl2AUoC8zA latest?i=liYaIZSW01g:YhRm8pFTBcs:F7zBnMy latest?i=liYaIZSW01g:YhRm8pFTBcs:V_sGLiP latest?d=qj6IDK7rITs latest?i=liYaIZSW01g:YhRm8pFTBcs:gIN9vFwliYaIZSW01g
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments