Created
March 2, 2021 23:01
-
-
Save mcindea/609f6b4a367f5d9f5181b8a6c470a198 to your computer and use it in GitHub Desktop.
Stops mining software nanominer if Plex Transcoder is running, and starts it again whenever Plex stops transcoding.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Limit the GPU power draw to 115W | |
nvidia-smi -pl 115 | |
function check_if_active { | |
nvidia-smi --query-compute-apps=name --format=csv,noheader | grep -q "$1" | |
} | |
while : ;do | |
if check_if_active "Plex Transcoder"; then | |
check_if_active nanominer \ | |
&& echo "Plex is transcoding, killing Nanominer" \ | |
&& killall -9 nanominer | |
elif ! pidof nanominer &>/dev/null; then | |
echo "Seems Plex is not transcoding, starting Nanominer" | |
screen -S nano -d -m ./nanominer | |
fi | |
sleep 3 | |
echo -n . | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment