Last active
May 23, 2016 17:38
-
-
Save justinledwards/cb2b7ac398a2847f75e86fe9b40fcbbe to your computer and use it in GitHub Desktop.
ubuntu lsi sas 3008 drive blink
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
first=$(sas3ircu 0 display | grep -B 8 $1) | |
second=$(sas3ircu 1 display | grep -B 8 $1) | |
third=$(sas3ircu 2 display | grep -B 8 $1) | |
CARD="" | |
if [[ "$first" ]]; then | |
CARD="0" | |
fi | |
if [[ "$second" ]]; then | |
CARD="1" | |
fi | |
if [[ "$third" ]]; then | |
CARD="2" | |
fi | |
diskinfo=$(echo "$first$second$third") | |
ENCLOSURE="$(echo "$diskinfo" | grep 'Enclosure' | awk -F: '{print $2}' | tr -d ' ')" | |
SLOT="$(echo "$diskinfo" | grep 'Slot' | awk -F: '{print $2}' | tr -d ' ')" | |
echo "card is $CARD enclosure is $ENCLOSURE slot is $SLOT" | |
CMD="$2" | |
if [ -z "$CMD" ] || ( [[ "$CMD" != on ]] && [[ "$CMD" != off ]] ); then | |
echo -e "Error:\tErroneous or no command. Please specify a command. (on/off)" >&2 | |
echo -e "Usage:\tblinkdrive serialnum on" >&2 | |
echo "" >&2 | |
exit 1 | |
fi | |
if [ "$CMD" == "on" ]; then | |
echo "Running Command: sas3ircu $CARD LOCATE $ENCLOSURE:$SLOT ON" | |
sas3ircu "$CARD" LOCATE "$ENCLOSURE":"$SLOT" ON | |
elif [ "$CMD" == "off" ]; then | |
echo "Running Command: sas3ircu $CARD LOCATE $ENCLOSURE:$SLOT OFF" | |
sas3ircu "$CARD" LOCATE "$ENCLOSURE":"$SLOT" OFF | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get latest zip from http://www.avagotech.com/cs/Satellite?pagename=AVG2%2FsearchLayout&locale=avg_en&Search=sas3ircu&submit=search | |
unzip SAS3* | |
cd SAS3*/sas3ircu_linux_x64_rel/ | |
chmod +x sas3ircu | |
cp sas3ircu /usr/local/sbin/ | |
sas3ircu 0 display |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment