Skip to content

Commit

Permalink
aisingapore#466 / aisingapore#417 - shell script to kill TagUI processes
Browse files Browse the repository at this point in the history
Follow-up update to previous 2 commits below -

Making a commit to improve on the existing script to kill TagUI processes.

For eg if Ctrl+C is used to kill TagUI prematurely, TagUI main process would lose the control to do clean-up of integrations (SikuliX, R, Python, Chrome) and Chrome browser.

This shell script (for all the 3 OSes) will kill those processes to free up memory and allows TagUI to start running from a clean state.

These actions are not done by default when TagUI is launched, as it is expected that TagUI exits cleanly. Otherwise cleaning up all processes by default will hide potential issues should they arise and they will end up not getting reported.
  • Loading branch information
kensoh committed Jun 27, 2019
1 parent 62d57c4 commit 0af777f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/end_processes
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ while true; do
done

while true; do
sikuli_process_id="$(ps -x | grep tagui\.sikuli | grep -v 'grep tagui\.sikuli'| sed -e 's/^[ ]*//' | cut -d' ' -f 1 | sort -nur | head -n 1)"
sikuli_process_id="$(ps -x | grep tagui\.sikuli | grep -v 'grep tagui\.sikuli' | sed -e 's/^[ ]*//' | cut -d' ' -f 1 | sort -nur | head -n 1)"
if [ -n "$sikuli_process_id" ]; then
kill $sikuli_process_id > /dev/null 2>&1
else
Expand All @@ -32,7 +32,7 @@ while true; do
done

while true; do
python_process_id="$(ps -x | grep tagui_py\.py | grep -v 'grep tagui_py\.py'| sed -e 's/^[ ]*//' | cut -d' ' -f 1 | sort -nur | head -n 1)"
python_process_id="$(ps -x | grep tagui_py\.py | grep -v 'grep tagui_py\.py' | sed -e 's/^[ ]*//' | cut -d' ' -f 1 | sort -nur | head -n 1)"
if [ -n "$python_process_id" ]; then
kill $python_process_id > /dev/null 2>&1
else
Expand All @@ -41,7 +41,7 @@ while true; do
done

while true; do
r_process_id="$(ps -x | grep tagui_r\.R | grep -v 'grep tagui_r\.R'| sed -e 's/^[ ]*//' | cut -d' ' -f 1 | sort -nur | head -n 1)"
r_process_id="$(ps -x | grep tagui_r\.R | grep -v 'grep tagui_r\.R' | sed -e 's/^[ ]*//' | cut -d' ' -f 1 | sort -nur | head -n 1)"
if [ -n "$r_process_id" ]; then
kill $r_process_id > /dev/null 2>&1
else
Expand All @@ -50,7 +50,7 @@ while true; do
done

while true; do
tagui_process_id="$(ps -x | grep /tagui/src | grep -v 'grep /tagui/src'| sed -e 's/^[ ]*//' | cut -d' ' -f 1 | sort -nur | head -n 1)"
tagui_process_id="$(ps -x | grep tagui/src | grep -v 'grep tagui/src' | grep -v 'end_processes' | sed -e 's/^[ ]*//' | cut -d' ' -f 1 | sort -nur | head -n 1)"
if [ -n "$tagui_process_id" ]; then
kill $tagui_process_id > /dev/null 2>&1
else
Expand Down

0 comments on commit 0af777f

Please sign in to comment.