eagle470 Posted August 2, 2022 Share Posted August 2, 2022 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" #!/bin/bash # 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 fi 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 fi else # 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 fi fi sleep 1 done 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. Quote Link to comment
Recommended Posts
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.