Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CUBRIDQA-1214] Update xkill #672

Merged
merged 5 commits into from
Apr 5, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 24 additions & 16 deletions CTP/shell/init_path/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1070,21 +1070,8 @@ function xkill

if [ "$OS" == Windows_NT ]
then
win_svr_pid=`get_win_service_pid`
for pid in `ps -W | grep "${strkill}" | awk '{print $1}'`
do
is_in_white_list=0
for svr_id in ${win_svr_pid}
do
if [ "${pid}" == "${svr_id}" ]; then
is_in_white_list=1
break
fi
done
if [ "${is_in_white_list}" == "0" ]; then
/bin/kill -9 -f ${pid}
fi
done
win_svr_pid=$(get_win_service_pid | tr '\n' '|')
ps -W | grep "${strkill}" | awk -v win_svr_pid="${win_svr_pid}" '{ if (index(win_svr_pid, $1) == 0) print $1 }' | xargs -I {} /bin/kill -9 -f {}
else
if [ $fullCommand -eq 1 ]
then
Expand Down Expand Up @@ -1122,7 +1109,28 @@ function xkill_java_windows {


function get_win_service_pid {
wmic PROCESS WHERE \( Name != \'wmic.exe\' and CommandLine LIKE \'%service.Server%\' \) get processid | grep -v ProcessId | sed 's/ //g'
wmic PROCESS WHERE "(
Name = 'System Idle Process' or
Name = 'System' or
Name = 'smss.exe' or
Name = 'csrss.exe' or
Name = 'wininit.exe' or
Name = 'winlogon.exe' or
Name = 'services.exe' or
Name = 'lsass.exe' or
Name = 'svchost.exe' or
Name = 'conhost.exe' or
Name = 'WmiPrvSE.exe' or
Name = 'taskhostex.exe' or
Name = 'dwm.exe' or
Name = 'rdpclip.exe' or
Name = 'explorer.exe' or
Name = 'wmic.exe'
) or (
CommandLine LIKE '%service.Server%' or
CommandLine LIKE '%RMIService%' or
CommandLine LIKE '%start_service%'
)" get processid | grep -v ProcessId | sed 's/ //g'
}

#format number like 0|123|456
Expand Down
Loading