Skip to content

Instantly share code, notes, and snippets.

@markizano
Created January 13, 2022 22:36
Show Gist options
  • Save markizano/4f48d2a1bb928bf31d30f7c3b2ef443e to your computer and use it in GitHub Desktop.
Save markizano/4f48d2a1bb928bf31d30f7c3b2ef443e to your computer and use it in GitHub Desktop.
Watch my miner - stop it when the window opens and resume it when the window closes. I use with `/usr/bin/screen -L`
#!/bin/bash
export startlog='ZIL PoW Window Start' \
endlog='ZIL PoW Window End' \
minerproc='/usr/local/share/gminer-2.54/miner' \
screenlog=~/screenlog.0
tail -n0 -F "$screenlog" | \
while read logline; do
echo "$logline" | grep -qF "$startlog" && {
echo "Pausing gminer...";
sudo pkill -u rvn -SIGSTOP -f "$minerproc";
};
echo "$logline" | grep -qF "$endlog" && {
echo "Resuming gminer.";
sudo pkill -u rvn -SIGCONT -f "$minerproc";
};
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment