PK œqhYî¶J‚ßF ßF ) nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/
Dir : /opt/maint/bin/ |
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 IP: 209.182.202.254 |
Dir : //opt/maint/bin/bbu_relearn.sh |
#!/bin/bash # Do a relearn when BBU charge falls low # Vanessa V 6/7/12 # Define variables ARCH=$(uname -p) if [ "$ARCH" == "x86_64" ]; then MEGAPATH="/opt/MegaRAID/MegaCli/MegaCli64" else MEGAPATH="/opt/MegaRAID/MegaCli/MegaCli" fi # If we already have something in progress, don't do anything STATUS=$($MEGAPATH -AdpBbuCmd -GetBbuStatus -aALL | grep "Charger Status") if echo "$STATUS" | grep -q -i "In Progress"; then echo "Relearn already in progress... exiting" exit 0 else # If we already have a progress file, remove it (because we're not in progress anymore) [ -f /home/nagios/bbu_relearn.progress ] && rm -f /home/nagios/bbu_relearn.progress [ -f /home/nagios/bbu_relearn.error ] && rm -f /home/nagios/bbu_relearn.error # See if our BBU is undercharged if [ -f $MEGAPATH ]; then BBU_OK=$(sudo $MEGAPATH AdpBbuCmd -GetBbuStatus -aALL | grep '^isSOHGood' |awk '{print $2}') if [ "$BBU_OK" == "Yes" ]; then # BBU_OK=$($MEGAPATH -AdpBbuCmd -GetBbuStatus -aALL | awk '$0~/Relative State of Charge/ {print $(NF-1)}') BBU_OK=$(cat /home/nagios/raid_battery_level) if [ "$BBU_OK" -lt 80 ]; then # The BBU charge is too low, try to force a relearn (the attempt will be logged in the raid controller logs) if ! $MEGAPATH -AdpBbuCmd -BbuLearn -a0; then touch /home/nagios/bbu_relearn.error chown nagios:nagios /home/nagios/bbu_relearn.error else [ -f /home/nagios/bbu_relearn.error ] && rm -f /home/nagios/bbu_relearn.error touch /home/nagios/bbu_relearn.progress chown nagios:nagios /home/nagios/bbu_relearn.progress # Touch a file to show when this relearn occurred touch "/home/nagios/.relearn.$(date +%s)" chown nagios:nagios "/home/nagios/.relearn.$(date +%s)" fi else echo "Battery is OK" exit 0 fi fi fi fi rm -f MegaSAS.log rm -f CtDbg.log