Add some additional sleeping, some checks to know which part produces the message "text file busy"

This commit is contained in:
Cody Cook 2017-10-18 10:11:04 -07:00
commit 0ef2d21602

View file

@ -16,7 +16,7 @@ attempts=0
echo "This tool attempts to resolve RR4360 PSU issues by resetting the SMBus if necessary. It will try 10 times and if it fails, will need to try and be resolved manually." echo "This tool attempts to resolve RR4360 PSU issues by resetting the SMBus if necessary. It will try 10 times and if it fails, will need to try and be resolved manually."
get_tools() { get_tools() {
printf "Acquiring tools... " printf "Acquiring latest tools... "
wget -q "$get_inb" -O "$inb" wget -q "$get_inb" -O "$inb"
wget -q "$get_outb" -O "$outb" wget -q "$get_outb" -O "$outb"
chmod +x "$inb" "$outb" chmod +x "$inb" "$outb"
@ -30,9 +30,8 @@ check_problem() {
} }
validate_problem() { validate_problem() {
if [[ "$problem" -ne 7 ]] if [[ "$problem" -ne 7 ]]; then
then printf " SMBus reporting invalid value; reported: %s" "$problem"
printf " SMBus reporting invalid value."
fix fix
else else
echo " The SMBus is currently operating as normal. Exiting script." echo " The SMBus is currently operating as normal. Exiting script."
@ -43,25 +42,23 @@ fi
fix() { fix() {
attempts=$((attempts+1)) attempts=$((attempts+1))
printf " Attempt %s at fixing the SMBus..." "$attempts" printf " Attempt %s at fixing the SMBus..." "$attempts"
"$outb" 0xf00f 3
sleep 1 sleep 1
"$outb" 0xf00f 7 printf " (#3)... "
"$outb" 0xf00f 3 2>/dev/null
sleep 1
printf " (#7)... "
"$outb" 0xf00f 7 2>/dev/null
sleep 1 sleep 1
printf " fix applied. \n" printf " fix applied. \n"
verify_fix verify_fix
} }
verify_fix(){ verify_fix(){
if [[ "$attempts" -lt 10 ]] if [[ "$attempts" -lt 10 ]]; then
then
check_problem check_problem
else else
printf "Attempted to recover this %s times... seek alternative recovery method." "$attempts" printf "Attempted to recover this %s times... seek alternative recovery method." "$attempts"
exit 1 exit 1
fi fi
} }
get_tools get_tools
check_problem check_problem