I am trying to make the following script echo 0 for all raid drives that come back with a 'U' and a 1 when it returns a '_' for raid drive down. However it still print [UU] or [__]
What am i conceptually doing wrong here?
Bash:
#!/bin/bash
mdstat=$(cat /proc/mdstat | awk '{print $6}' | grep -A1 'sd' | grep U)
0='U'
1='_'
if [$mdstat = 1]
then
echo '0'
else
echo '1'
fi
#The code below basically tells our monitoring system the output of the script.
#This is the only way we can get it to alert for raid.
#We use OpManager for Network and Server monitoring.
echo "Data:"
echo "mdstat\t$mdstat"
What am i conceptually doing wrong here?
Last edited: