Skip to content

Instantly share code, notes, and snippets.

@matti
Created August 28, 2021 07:37
Show Gist options
  • Save matti/4aa0f8cf0ae166bf5e3cb1ef615218e5 to your computer and use it in GitHub Desktop.
Save matti/4aa0f8cf0ae166bf5e3cb1ef615218e5 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -euo pipefail
while true; do
(
exec cpuminer-gr-1.1.9-x86_64_ubuntu_20_04/cpuminer-zen2 -a gr -o stratum+tcps://stratum-eu.rplant.xyz:17056 -u RVmmg18q53WyAzPCV3v3JsGYoD4fswnjiJ.mara -t 47
) &
miner_pid=$!
(
sleep 10800
wait $!
echo " -- killing miner"
kill -2 $miner_pid || echo " -- miner kill failed"
) &
killer_pid=$!
wait $miner_pid
echo " -- miner exited"
echo " -- killing killer"
set +e
kill $killer_pid
set -e
echo ""
echo " -- restart in 1s"
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment