Skip to content

Commit c0a21ef

Browse files
authored
Merge pull request #320 from silkenelson/enh_DRP_pingresetcheck
add check if a server is pinging before going to reset
2 parents 069d28d + c15b5a1 commit c0a21ef

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

scripts/serverStat

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,17 @@ if [[ "${NAME,,}" == *drp* ]] && { [[ $CMD == "off" ]] || [[ $CMD == "cycle" ]];
142142
exit 1
143143
fi
144144

145+
if [[ "${NAME,,}" == *drp* ]] && [[ $CMD == "reset" ]]; then
146+
if ping -w 2 "$NAME" >/dev/null 2>&1; then
147+
printf "%s is reachable, are you sure you want to reset (n/y)" "${NAME}"
148+
read -r ANSWER
149+
if [[ $ANSWER == 'n' ]] || [[ $ANSWER == 'N' ]] || [[ $ANSWER == 'no' ]]; then
150+
printf "quit now.\n"
151+
exit 0
152+
fi
153+
fi
154+
fi
155+
145156
#check if this is a DAQ device
146157
if [[ $ISSRV -lt 1 ]] && [[ $HUTCH != 'unknown_hutch' ]]; then
147158
if [[ $HUTCH == 'cxi' ]]; then # only supporting primary daq for now

0 commit comments

Comments
 (0)