#!/bin/bash # description: RR4360 PSU fix, pre-6.8.0 # NETGEAR Proprietary # email: readynassupport@netgear.com # usage: ./scriptname #set variables get_inb="http://ntgr.support/tools/inb" get_outb="http://ntgr.support/tools/outb" inb="/etc/frontview/support/inb" outb="/etc/frontview/support/outb" 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." get_tools() { printf "Acquiring tools... " wget -q "$get_inb" -O "$inb" wget -q "$get_outb" -O "$outb" chmod +x "$inb" "$outb" printf " done! \n" } check_problem() { printf "Querying the SMBus for its current status..." problem=$($inb 0xf00f) validate_problem } validate_problem() { if [[ "$problem" -ne 7 ]] then printf " SMBus reporting invalid value." fix else echo " The SMBus is currently operating as normal. Exiting script." exit 0 fi } fix() { attempts=$((attempts+1)) printf " Attempt %s at fixing the SMBus..." "$attempts" "$outb" 0xf00f 3 sleep 1 "$outb" 0xf00f 7 sleep 1 printf " fix applied. \n" verify_fix } verify_fix(){ if [[ "$attempts" -lt 10 ]] then check_problem else printf "Attempted to recover this %s times... seek alternative recovery method." "$attempts" exit 1 fi } get_tools check_problem