Stuck in P-State P0 after transcode finished on NVIDIA

Yes but it also cuts the transcoding when you actually watch a movie.

This is my script to detect and kill bad Plex process :slight_smile:

#!/bin/bash
TOKILL=""
CPT_TRANSCODE=-1
CPT_SERVER=-1

for ELEMENT in $(lsof /dev/nvidia0 | awk '{print $1 "@" $2}')
do
 IFS='@' read -r -a array <<< "$ELEMENT"
 if [ "${array[0]}" != "Xorg" ] && [ "${array[0]}" != "ffmpeg" ]
 then
  if [ "${array[0]}" = "Plex\x20T" ]
  then
  ((CPT_TRANSCODE++))
  fi
  if [ "${array[0]}" = "Plex\x20M" ]
  then
   ((CPT_SERVER++))
   TOKILL="${array[1]}"
  fi
 fi
done

if [ $CPT_SERVER -gt 0 ] && [ $CPT_TRANSCODE -lt 1 ] && [ "$1" != "test" ]
then
 kill -9 "$TOKILL"
fi
if [ "$1" == "test" ]
then
 echo "$TOKILL"
fi

2 Likes