diff --git a/xymon/xymon.libs.alert.sh b/xymon/xymon.libs.alert.sh index 76d1370..d5eacdf 100755 --- a/xymon/xymon.libs.alert.sh +++ b/xymon/xymon.libs.alert.sh @@ -23,6 +23,7 @@ REMOTE_SSH_USER="xymon-ssh" temp_dir=$(mktemp -d -t xymon-libs-alert-XXXXXX.tmp) debug_stdout="${temp_dir}/debug.stdout" +debug_stderr="${temp_dir}/debug.stderr" service_list="${temp_dir}/services.error.list" # }}} @@ -36,7 +37,7 @@ fi if [ "${BBSVCNAME}" = "libs" ]; then [ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : ${BBHOSTNAME} — ${BBSVCNAME} error" > "${debug_stdout}" else - [ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : ${BBHOSTNAME} — ${BBSVCNAME} probe is not managed." > "${debug_stdout}" + [ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : ${BBHOSTNAME} — ${BBSVCNAME} probe is not managed." > "${debug_stderr}" [ "${DEBUG}" -eq "0" ] || rm -rf -- "${temp_dir}" exit 0 fi @@ -103,6 +104,7 @@ if echo "${BBALPHAMSG}" | grep -qE "\\&yellow The following processes.*" ; then else [ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : while bin_path loop — ${service_name} need to be restarted." >> "${debug_stdout}" [ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : while bin_path loop — ssh -o StrictHostKeyChecking=no ${REMOTE_SSH_USER}@${BBHOSTNAME} sudo systemctl restart ${service_name}.service" >> "${debug_stdout}" + ssh -o StrictHostKeyChecking=no ${REMOTE_SSH_USER}@${BBHOSTNAME} sudo systemctl restart ${service_name}.service >> "${debug_stdout}" 2> "${debug_stderr}" fi # }}} done < "${service_list}" @@ -110,6 +112,7 @@ if echo "${BBALPHAMSG}" | grep -qE "\\&yellow The following processes.*" ; 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 -o StrictHostKeyChecking=no ${REMOTE_SSH_USER}@${BBHOSTNAME} sudo systemctl restart xymon-client.service" >> "${debug_stdout}" + ssh -o StrictHostKeyChecking=no ${REMOTE_SSH_USER}@${BBHOSTNAME} sudo systemctl restart xymon-client.service >> "${debug_stdout}" 2> "${debug_stderr}" # }}} fi