1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 02:51:03 +00:00

[plugins/whois_] stop EXTRACT_RE after the first match

Signed-off-by: Olivier Mehani <shtrom@ssji.net>
This commit is contained in:
Olivier Mehani 2020-11-27 00:31:04 +11:00 committed by Lars Kruse
parent a10647b95e
commit 0ab1e127a2

View file

@ -101,7 +101,7 @@ fetch() {
CACHEFILE="${MUNIN_PLUGSTATE}/$(basename "${0}").${FIELDNAME}.cache" CACHEFILE="${MUNIN_PLUGSTATE}/$(basename "${0}").${FIELDNAME}.cache"
if [ -z "$(find "${CACHEFILE}" -mmin -${CACHE_EXPIRY} 2>/dev/null)" ]; then if [ -z "$(find "${CACHEFILE}" -mmin -${CACHE_EXPIRY} 2>/dev/null)" ]; then
EXPIRY="$(whois "${NAME}" 2>/dev/null | sed -n "${EXTRACT_RE}p")" EXPIRY="$(whois "${NAME}" 2>/dev/null | sed -n "${EXTRACT_RE}p;T;q")" # T;q exits after printing the first match
DELTA_TS=U DELTA_TS=U
if [ -n "${EXPIRY}" ]; then if [ -n "${EXPIRY}" ]; then
EXPIRY_TS="$(date +%s -d "${EXPIRY}")" EXPIRY_TS="$(date +%s -d "${EXPIRY}")"