***Guide*** How to stop Extraneous GPU use when someone starts transcoding a Plex stream

Recommended Posts

First you need to get the name of you containers written down. Make sure they are named somethingsimple and easily identifiable as unique to avoid confusion.

You'll need use use the script below, set it to run at "Array Startup"


# Check if nvidia-smi daemon is running and start it if not.
if [[ `ps ax | grep nvidia-smi | grep daemon` == "" ]]; then
    /usr/bin/nvidia-smi daemon

TREX=`docker container ls -q --filter name=T-Rex`

while true; do
    if [[ `/usr/bin/nvidia-smi | grep plexmediaserver` == "" ]]; then
        # If Plex is not transcoding, start the trex-miner container if it is not running.
        if [[ `docker ps | grep $TREX` == "" ]]; then
            echo "No Plex, starting Trex."
            docker start $TREX
        # If Plex is transcoding, stop the trex-miner container if it is running.
        if [[ `docker ps | grep $TREX` != "" ]]; then
            echo "Plex running, stopping Trex."
            docker stop $TREX
    sleep 1

You may need to change trex-miner to match what your container is named.


plexmediaserver is the name of the process that appears in the nvidia-smi control panel. I had to make a guess as I couldn't see the whole thing and can't figure out the command to show it to me. I am running the Hotio container currently but have had this working with the Plex, inc, Linuxserver and binhex versions as well.


I did not write this script, it is borrowed.

2022-08-02 11_55_13-root@Unraid1_ ~ _ bash --login (Unraid1) - Brave.png

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.