mirror of
https://github.com/unraid/webgui.git
synced 2026-01-10 03:30:03 -06:00
Merge pull request #2334 from bergware/master
monitor_nchan: fix incorrect PID reference in pkill / pgrep
This commit is contained in:
@@ -5,6 +5,7 @@ disk_load=/var/local/emhttp/diskload.ini # disk load statistics
|
||||
nginx=/var/run/nginx.socket # nginx local access
|
||||
status=http://localhost/pub/session?buffer_length=1 # nchan information about GUI subscribers
|
||||
nchan_list=/tmp/nchan_list.tmp
|
||||
pid_file=/var/run/monitor_nchan.pid
|
||||
nchan_id=$(basename "$0")
|
||||
|
||||
nchan_subs(){
|
||||
@@ -24,17 +25,19 @@ nchan_idle(){
|
||||
|
||||
nchan_stop() {
|
||||
echo -n >$nchan_list
|
||||
pid=$(cat $pid_file)
|
||||
while IFS=$'\n' read -r nchan; do
|
||||
[[ ${nchan##*/} == '.*' ]] && continue
|
||||
echo $nchan >>$nchan_list
|
||||
pkill --ns $$ -f $nchan
|
||||
pkill --ns $pid -f $nchan
|
||||
done <<< $(ps -eo cmd | grep -Po '/usr/local/emhttp/.*/nchan/.*')
|
||||
}
|
||||
|
||||
nchan_start() {
|
||||
[[ -e $nchan_list ]] || return
|
||||
pid=$(cat $pid_file)
|
||||
while IFS=$'\n' read -r nchan; do
|
||||
if ! pgrep --ns $$ -f $nchan >/dev/null; then
|
||||
if ! pgrep --ns $pid -f $nchan >/dev/null; then
|
||||
$nchan &>/dev/null &
|
||||
fi
|
||||
done < $nchan_list
|
||||
@@ -78,4 +81,5 @@ while :; do
|
||||
fi
|
||||
# check every 30 seconds
|
||||
sleep 30
|
||||
done &
|
||||
done & echo $! >$pid_file
|
||||
|
||||
|
||||
Reference in New Issue
Block a user