use correct regex and comparison to match peers

This commit is contained in:
Simon Biewald 2020-07-09 18:57:01 +02:00
parent df7c6257a5
commit 9107867fa1
No known key found for this signature in database
GPG Key ID: DAD5F452603F1344

View File

@ -576,8 +576,8 @@
Register --test-no TIME-3182 --preqs-met "${PREQS_MET}" --weight L --network NO --category security --description "Check OpenNTPD has working peers"
if [ ${SKIPTEST} -eq 0 ]; then
# Format is "xx/yy peers valid, ..."
FIND=$(${NTPCTLBINARY} -s status | ${EGREPBINARY} -o "[0-9]{1,4}/" | ${EGREPBINARY} -o "[0-9]{1,4}" )
if [ -n "${FIND}" ] || [ "${FIND}" -eq 0 ]; then
FIND=$(${NTPCTLBINARY} -s status | ${EGREPBINARY} -o '[0-9]+/[0-9]+' | ${CUTBINARY} -d '/' -f 1)
if [ -z "${FIND}" ] || [ "${FIND}" -eq 0 ]; then
ReportWarning "${TEST_NO}" "OpenNTPD has no peers" "${NTPCTLBINARY} -s status"
fi
fi