Preview:
Edit
Full Screen
Copy code
1    # If CPU or GPU usage exceeds the threshold, stop mining and send an alert
2    if cpu_usage > 80 or gpu_usage > 80:
3        logger.warning("CPU or GPU usage too high! Stopping mining...")
4        os.system("killall miner")
5        # Send an alert to the user (e.g., via email or push notification)
6
7    # Sleep for 10 seconds before checking again
8    time.sleep(10)
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter