From fedd213ff4e5bdc60a8ec1806097df084ff9e61e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Thu, 10 Oct 2019 11:43:11 +0200 Subject: [PATCH] Set a pattern for unmodified files --- xymon/xymon.files.alert.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/xymon/xymon.files.alert.sh b/xymon/xymon.files.alert.sh index 1d2e58c..f94abc0 100755 --- a/xymon/xymon.files.alert.sh +++ b/xymon/xymon.files.alert.sh @@ -41,9 +41,8 @@ fi # }}} # Check if a file exceeds it's modification time {{{ -## TODO : Set a better pattern ("File was modified .* ago",…) -if echo "${BBALPHAMSG}" | grep -qE "\\&yellow > "${debug_stdout}" +if echo "${BBALPHAMSG}" | grep -qE "File was modified.*ago - should be.*" ; then + [ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Test file — Some files exceeds their modification time." >> "${debug_stdout}" ## Get the list of files path ## TODO : Set a pattern for both yellow and red colors echo "${BBALPHAMSG}" | sed -n 's;^\&yellow \(.*\);\1;p' > "${file_list}" @@ -82,8 +81,10 @@ if echo "${BBALPHAMSG}" | grep -qE "\\&yellow > "${debug_stdout}" [ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Test service — ssh -n -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ${REMOTE_SSH_USER}@${BBHOSTNAME} sudo systemctl restart xymon-client.service" >> "${debug_stdout}" - ssh -n -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "${REMOTE_SSH_USER}"@"${BBHOSTNAME}" "sudo systemctl restart xymon-client.service" >> "${debug_stdout}" 2>> "${debug_stderr}" + #ssh -n -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "${REMOTE_SSH_USER}"@"${BBHOSTNAME}" "sudo systemctl restart xymon-client.service" >> "${debug_stdout}" 2>> "${debug_stderr}" # }}} +else + [ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Test file — All files seems up to date." >> "${debug_stdout}" fi # }}}