Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
HaiSoft (public)
Wrong Listener Killer
Commits
c573ca0c
Commit
c573ca0c
authored
May 29, 2017
by
UltimateByte
Committed by
GitHub
May 29, 2017
Browse files
rework for before actions
parent
1162e3e4
Changes
1
Show whitespace changes
Inline
Side-by-side
wlk.sh
View file @
c573ca0c
...
@@ -132,9 +132,15 @@ fn_evaluate(){
...
@@ -132,9 +132,15 @@ fn_evaluate(){
# Execute an action before proceeding
# Execute an action before proceeding
fn_actionbefore
(){
fn_actionbefore
(){
if
[
-n
"
${
actionbefore
}
"
]
;
then
if
[
-n
"
${
actionbefore
}
"
]&&[
"
${
harm
}
"
==
"1"
]&&[
-z
"
${
actiontaken
}
"
]
;
then
fn_logecho
"[ACTION] Applying actionbefore:
${
actionbefore
}
"
fn_logecho
"[ACTION] Applying actionbefore:
${
actionbefore
}
"
${
actionbefore
}
${
actionbefore
}
actiontaken
=
"1"
refresh
=
"1"
else
# Misc var to tell that an action has been taken
actiontaken
=
"1"
fn_logecho
"[ACTION] Refreshing info
${
pid
}
"
fi
fi
}
}
...
@@ -155,13 +161,18 @@ fn_action(){
...
@@ -155,13 +161,18 @@ fn_action(){
fn_logecho
"[INFO] Actual : Name:
${
pidname
}
\t
User:
${
piduser
}
\t
Path:
${
pidcommand
}
"
fn_logecho
"[INFO] Actual : Name:
${
pidname
}
\t
User:
${
piduser
}
\t
Path:
${
pidcommand
}
"
# Take the "before" action
# Take the "before" action
fn_actionbefore
fn_actionbefore
# If a before action has been done, refresh info
if
[
-n
"
${
refresh
}
"
]
;
then
unset
refresh
fn_define_vars
fn_evaluate
fn_action
else
# Kill the app
# Kill the app
fn_logecho
"[ACTION] Killing PID
${
pid
}
"
fn_logecho
"[ACTION] Killing PID
${
pid
}
"
kill
-9
"
${
pid
}
"
kill
-9
"
${
pid
}
"
# Reset harm for future tests
# Reset harm for future tests
unset
harm
unset
harm
# Misc var to tell that an action has been taken
actiontaken
=
"1"
# Misc var to count how many time we ran this
# Misc var to count how many time we ran this
count
=
$((
count+1
))
count
=
$((
count+1
))
# If $count is greater or equel to $maxruns; then end there
# If $count is greater or equel to $maxruns; then end there
...
@@ -173,6 +184,7 @@ fn_action(){
...
@@ -173,6 +184,7 @@ fn_action(){
sleep
"
${
sleeptime
}
"
sleep
"
${
sleeptime
}
"
fn_run_functions
fn_run_functions
fi
fi
fi
elif
[
"
${
actiontaken
}
"
==
"1"
]
;
then
elif
[
"
${
actiontaken
}
"
==
"1"
]
;
then
fn_logecho
"[OK] The process on port
${
portcheck
}
now meets requirements"
fn_logecho
"[OK] The process on port
${
portcheck
}
now meets requirements"
fn_mail_alert
fn_mail_alert
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment