Tuesday, May 7, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 1052  / 1 Year ago, sat, may 27, 2023, 7:31:18

Recently I've started mining litecoins. My miner consists of 3 Radeon R9 290x GPUs. From time to time one of them (not a specific one, it happens randomly) stops mining. Usually restarting cgminer (mining program) doesn't help, the only thing that helps is reboot. Next week I'm leaving for 8 days and I have nobody to do that for me so I thought of a script that would do that automatically.



The script would have to periodically verify if all GPUs are working and if not - reboot.
I think temperature reading is the easiest thing to determine if all cards are working. I know how to read temperature, reboot, add stuff to cron. What I don't is how to put it all together.



Get temperature command:



 aticonfig --odgt --adapter=all | grep Sensor:


Output looks like this:



 Sensor: Temperature - 77.00 C
Sensor: Temperature - 77.00 C
Sensor: Temperature - 77.00 C


I would like the script to read the numerical value and reboot if it drops below XX.



Can you please help me out?


More From » scripts

 Answers
0

Save this a script and make it executable (chmod +x scriptname.sh) and run it with bash using sudo as reboot requires root.



#! /bin/bash
while :
do
temp=$(aticonfig --odgt --adapter=all | grep Sensor: | sed 's/[a-zA-Z:-]//g'| tr -d ' ')

action=$(echo $temp|awk '{ print ($1 < 76) ? "reboot" : "" }')

$action
sleep 1
done


I have not tested it with the ATI command as I don't have access to the command, but it works replacing aticonfig --odgt --adapter=all | grep Sensor: with echo 'Sensor: Temperature - 77.00 C'. This was how I tested it.



The 76 is the restart temp. You can edit that.


[#27665] Monday, May 29, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
chilgirlguid

Total Points: 123
Total Questions: 114
Total Answers: 121

Location: Macau
Member since Mon, Nov 16, 2020
4 Years ago
;