bbustatus

#!/bin/bash
# set -x;

# 3Ware CLI BBU Report
#
# https://martinlanner.com/2013/08/24/3ware-raid-status-script/
#
# You will need to install the tw_cli utility which you can
# download for free from www.3ware.com or you can get it from
# 3rd party repositories.

##########################################################
#  Do NOT edit below unless you know what you're doing.  #
##########################################################

# Get info on BBU status
STATUS_BBU=$(tw_cli /c0/bbu show | awk 'FNR == 4 {print $4}');
MESSAGE=$(tw_cli /c0/bbu show);
echo "${MESSAGE}";

# Check the status and set return-code
if [ "$STATUS_BBU" != "OK" ] ;
then
        # BBU must be not OK - ERROR!
        exit 1;
fi
exit 0;