Set a pattern for unmodified files

This commit is contained in:
Jeremy Gardais 2019-10-10 11:43:11 +02:00
parent 3720b3cc11
commit fedd213ff4
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 5 additions and 4 deletions

View File

@ -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 <a.*" ; then
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Test file — Some services need to be restarted." >> "${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 <a.*>\(.*\)</a>;\1;p' > "${file_list}"
@ -82,8 +81,10 @@ if echo "${BBALPHAMSG}" | grep -qE "\\&yellow <a.*" ; then
# Also restart xymon-client service {{{
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Test service — xymon-client also need to be restarted." >> "${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
# }}}