Commit 9c3df5d3 authored by UltimateByte's avatar UltimateByte Committed by GitHub
Browse files

Downaction

parent 8eae2ab9
......@@ -82,14 +82,14 @@ fn_define_pid(){
# If nothing listens unpon first start
if [ -z "${pid}" ]&&[ -z "${actiontaken}" ]; then
fn_logecho "[INFO] Nothing found on port ${portcheck}"
if [ -n "${downaction}" ]; then
fn_logecho "[ACTION] Executing command: ${downaction}"
${downaction}
fi
# Exec downaction command
fn_downaction
exit
# If nothing listens after getting some processes killed
elif [ -z "${pid}" ]&&[ "${actiontaken}" == "1" ]; then
fn_logecho "[OK] Nothing listens on port ${portcheck} anymore | Exit"
fn_logecho "[OK] Nothing listens on port ${portcheck} anymore"
# Exec downaction
fn_downaction
# Send mail alert
fn_mail_alert
fi
......@@ -165,6 +165,14 @@ fn_postaction(){
fi
}
# Ececute an action when the process is down
fn_downaction(){
if [ -n "${downaction}" ]; then
fn_logecho "[ACTION] Service is down: Executing command: ${downaction}"
${downaction}
fi
}
## Take action
fn_action(){
## Problematic process was found
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment