Skip to content

Instantly share code, notes, and snippets.

@justinledwards
Last active May 23, 2016 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinledwards/cb2b7ac398a2847f75e86fe9b40fcbbe to your computer and use it in GitHub Desktop.
Save justinledwards/cb2b7ac398a2847f75e86fe9b40fcbbe to your computer and use it in GitHub Desktop.
ubuntu lsi sas 3008 drive blink
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
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