Skip to content

Commit ce0ebc3

Browse files
committed
FIX: various issues caught during testing
1 parent f78a86c commit ce0ebc3

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

scripts/serverStat

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ names_from_name(){
1313
INNAME=${INNAME//-ana/}
1414
fi
1515
CDSNAME=$INNAME
16-
if ! host "$CSDNAME" &> /dev/null; then
16+
if ! host "$CDSNAME" &> /dev/null; then
1717
echo "Host ($CDSNAME) not found in DNS, exiting..." >&2
1818
exit 1
1919
fi
@@ -77,7 +77,7 @@ for name in "tmo" "rix" "txi" "xpp" "xcs" "mfx" "cxi" "mec" "det"; do
7777
fi
7878
done
7979

80-
if host "$HOSTNAME"-fez $> /dev/null; then
80+
if host "$HOSTNAME"-fez &> /dev/null; then
8181
HOST_HAS_FEZ=1
8282
else
8383
HOST_HAS_FEZ=0
@@ -115,8 +115,7 @@ if [[ $NAME == *'172.21'* ]]; then
115115
NAME=$(host "$NAME" | awk '{print $5}' | cut -d "." -f 1)
116116
echo "$DEV is an IP for $NAME"
117117
else
118-
host "$NAME" $> /dev/null
119-
ISSRV=$?
118+
host "$NAME" &> /dev/null && ISSRV=1 || ISSRV=0
120119
fi
121120

122121
if [[ $NAME == *'-ipmi'* ]]; then
@@ -185,17 +184,17 @@ if [[ $ISSRV -lt 1 ]] && [[ $HUTCH != 'unknown_hutch' ]]; then
185184
fi
186185
fi
187186
if [[ $NAME ]]; then
188-
host "$NAME" $> /dev/null
187+
host "$NAME" &> /dev/null
189188
ISSRV=$?
190189
fi
191190
if [[ $ISSRV -lt 1 ]]; then
192191
echo "Host ($NAME) not found in DNS, exiting..." >&2
193192
exit 1
194193
fi
195-
SRVIP=host "$NAME" | awk '{print $4}'
194+
SRVIP="$(host "$NAME" | awk '{print $4}')"
196195
echo "server for $DEV is: $NAME"
197196
else
198-
SRVIP=host "$DEV" | awk '{print $4}'
197+
SRVIP="$(host "$DEV" | awk '{print $4}')"
199198
fi
200199

201200

@@ -215,9 +214,7 @@ elif [[ $CMD == "reset" ]]; then
215214
elif [[ $CMD == "expert" ]]; then
216215
echo "Host sdfconfig entry:"
217216
echo -e "-------------------------------------------------"
218-
# sdfconfig view currently broken, use search and hope for one entry only
219-
# sdfconfig --domain pcdsn view "$NAME"
220-
sdfconfig search "$NAME"
217+
sdfconfig view "$NAME".pcdsn
221218
echo -e ""
222219
echo -e "Checking IPMI power status:"
223220
echo -e "-------------------------------------------------"
@@ -237,7 +234,7 @@ elif [[ $CMD == "expert" ]]; then
237234
else
238235
echo "$NAME-ipmi does not ping."
239236
fi
240-
if host "$NAME"-fez $> /dev/null; then
237+
if host "$NAME"-fez &> /dev/null; then
241238
if ping -w 2 "$NAME"-fez >/dev/null 2>&1; then
242239
echo "$NAME-fez pings."
243240
else

0 commit comments

Comments
 (0)