From 29e9c7baf71aff825a45ee097d5600a942d23529 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Tue, 22 Jul 2025 17:16:01 -0600 Subject: [PATCH] monitor: Suppress errors --- usr/local/share/bastille/monitor.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr/local/share/bastille/monitor.sh b/usr/local/share/bastille/monitor.sh index 44ffe3c7..d68ef0f3 100644 --- a/usr/local/share/bastille/monitor.sh +++ b/usr/local/share/bastille/monitor.sh @@ -144,7 +144,7 @@ for _jail in ${JAILS}; do add) [ -z "${SERVICE}" ] && usage for _service in $(echo "${SERVICE}" | tr , ' '); do - if ! grep -qE "^${_service}\$" "${bastille_jail_monitor}"; then + if ! grep -qE "^${_service}\$" "${bastille_jail_monitor}" 2>&1; then echo "${_service}" >> "${bastille_jail_monitor}" echo "$(date '+%Y-%m-%d %H:%M:%S'): Added monitor for ${_service} on ${_jail}" >> "${bastille_monitor_logfile}" fi @@ -154,7 +154,7 @@ for _jail in ${JAILS}; do [ -z "${SERVICE}" ] && usage for _service in $(echo "${SERVICE}" | tr , ' '); do [ ! -f "${bastille_jail_monitor}" ] && break # skip if no monitor file - if grep -qE "^${_service}\$" "${bastille_jail_monitor}"; then + if grep -qE "^${_service}\$" "${bastille_jail_monitor}" 2>&1; then sed -i '' "/^${_service}\$/d" "${bastille_jail_monitor}" echo "$(date '+%Y-%m-%d %H:%M:%S'): Removed monitor for ${_service} on ${_jail}" >> "${bastille_monitor_logfile}" fi @@ -168,7 +168,7 @@ for _jail in ${JAILS}; do usage # Only one service per query fi [ ! -f "${bastille_jail_monitor}" ] && continue # skip if there is no monitor file - if grep -qE "^${SERVICE}\$" "${bastille_jail_monitor}"; then + if grep -qE "^${SERVICE}\$" "${bastille_jail_monitor}" 2>&1; then echo "${_jail}" continue fi