Now more silent by default to prevent log spam hourly.
Change debug to any value above 0 to enable output.
This commit is contained in:
parent
b55ed9e08b
commit
598f73ba85
2 changed files with 43 additions and 29 deletions
|
@ -1,62 +1,71 @@
|
|||
#!/bin/bash
|
||||
# description: RR4360 PSU fix, pre-6.8.0
|
||||
# NETGEAR Proprietary
|
||||
# email: readynassupport@netgear.com
|
||||
# usage: ./scriptname
|
||||
# description: RR4360 PSU fix
|
||||
# Runs for 10 attempts to try resolve PSU failure messages
|
||||
|
||||
|
||||
|
||||
#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
|
||||
debug=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."
|
||||
if [[ "$debug" -gt 0 ]]; then
|
||||
usrmsg="printf"
|
||||
else
|
||||
usrmsg="#"
|
||||
fi
|
||||
|
||||
get_tools() {
|
||||
printf "Acquiring latest tools... "
|
||||
wget -q "$get_inb" -O "$inb"
|
||||
wget -q "$get_outb" -O "$outb"
|
||||
if test -f "$inb" && test -f "$outb"; then
|
||||
$usrmsg "Tools exist - not acquiring again."
|
||||
else
|
||||
$usrmsg "Acquiring latest tools... "
|
||||
if ! test -f "$inb"; then
|
||||
$usrmsg "Missing inb; downloading now."
|
||||
wget -q "$get_inb" -O "$inb"
|
||||
fi
|
||||
if ! test -f "$outb"; then
|
||||
$usrmsg "Missing outb; downloading now."
|
||||
wget -q "$get_outb" -O "$outb"
|
||||
fi
|
||||
fi
|
||||
chmod +x "$inb" "$outb"
|
||||
printf " done! \n"
|
||||
}
|
||||
|
||||
check_problem() {
|
||||
printf "Querying the SMBus for its current status..."
|
||||
$usrmsg "Querying the SMBus for its current status..."
|
||||
problem=$($inb 0xf00f)
|
||||
validate_problem
|
||||
}
|
||||
|
||||
validate_problem() {
|
||||
if [[ "$problem" -ne 7 ]]; then
|
||||
printf " SMBus reporting invalid value; reported: %s" "$problem"
|
||||
$usrmsg " SMBus reporting invalid value; reported: %s" "$problem"
|
||||
fix
|
||||
else
|
||||
echo " The SMBus is currently operating as normal. Exiting script."
|
||||
$usrmsg " The SMBus is currently operating as normal. Exiting script."
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fix() {
|
||||
attempts=$((attempts+1))
|
||||
printf " Attempt %s at fixing the SMBus..." "$attempts"
|
||||
$usrmsg " Attempt %s at fixing the SMBus..." "$attempts"
|
||||
sleep 1
|
||||
printf " (#3)... "
|
||||
$usrmsg " (#3)... "
|
||||
"$outb" 0xf00f 3 2>/dev/null
|
||||
sleep 1
|
||||
printf " (#7)... "
|
||||
$usrmsg " (#7)... "
|
||||
"$outb" 0xf00f 7 2>/dev/null
|
||||
sleep 1
|
||||
printf " fix applied. \n"
|
||||
$usrmsg " 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"
|
||||
$usrmsg "Attempted to recover this %s times... seek alternative recovery method." "$attempts"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue