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 # }}}