Skip to content

Commit

Permalink
feat: tlinux4系统 proxy安装脚本及gsectl适配 (closed TencentBlueKing#2483)
Browse files Browse the repository at this point in the history
  • Loading branch information
Huayeaaa committed Nov 1, 2024
1 parent f14f01b commit f7b4c32
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions script_tools/agent_tools/agent2/setup_proxy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ get_pid_by_comm_path () {
local _pids pids
local pid
if [[ "${worker}" == "WORKER" ]]; then
read -r -a _pids <<< "$(ps --no-header -C $comm -o '%P|%p|%a' | awk -v proc="${comm}" -F'|' '$1 != 1 && $3 ~ proc' | awk -F'|' '{print $2}' | xargs)"
read -r -a _pids <<< "$(ps --no-header -C $comm -o 'ppid,pid,args' | awk -v proc="${comm}" '$1 != 1 && $3 ~ proc {print $2}' | xargs)"
elif [[ "${worker}" == "MASTER" ]]; then
read -r -a _pids <<< "$(ps --no-header -C $comm -o '%P|%p|%a' | awk -v proc="${comm}" -F'|' '$1 == 1 && $3 ~ proc' | awk -F'|' '{print $2}' | xargs)"
read -r -a _pids <<< "$(ps --no-header -C $comm -o 'ppid,pid,args' | awk -v proc="${comm}" '$1 == 1 && $3 ~ proc {print $2}' | xargs)"
else
read -r -a _pids <<< "$(ps --no-header -C "$comm" -o pid | xargs)"
fi
Expand Down
6 changes: 3 additions & 3 deletions script_tools/gsectl/proxy/linux/gsectl
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ get_process_runtime (){

for i in {1..20}
do
tmp_gse_master_pid_info=$(ps --no-header -C gse_${module} -o '%P' -o '|%p' -o '|%a' | awk -F'|' '$1 == 1 && $3 ~ /gse_'${module}'/' | awk -F'|' '{print $2}' | xargs)
tmp_gse_master_pid_info=$(ps --no-header -C gse_${module} -o 'ppid,pid,args' | awk '$1 == 1 && $3 ~ /'gse_${module}'/ {print $2}' | xargs)
read -r -a tmp_gse_agent_master_pids <<< "$tmp_gse_master_pid_info"

for _pid in "${tmp_gse_agent_master_pids[@]}"; do
Expand Down Expand Up @@ -351,7 +351,7 @@ __status (){
# 最多等待20s来判断是否真正启动成功
for i in {0..20}; do
if [ "$action" == "stop" ];then
if [ $(ps --no-header -C gse_${module} -o '%P' -o '|%p' -o '|%a' |egrep "${WORK_HOME}" |wc -l) -eq 0 ];then
if [ $(ps --no-header -C gse_${module} -o 'ppid,pid,args' |egrep "${WORK_HOME}" |wc -l) -eq 0 ];then
echo gse_${module} $action $action success
break
elif [ $i -eq 20 ];then
Expand Down Expand Up @@ -423,7 +423,7 @@ _status () {
# 初筛,考虑到gse组件的父、子进程都是名为gse_${module}的,且它的父进程应该是等于1
# ps的-o参数指定输出字段%P(ppid)、%p(pid)、%a(args)
# 所以下面命令是拉出所有进程名为gse_${module},且父进程为1,进程参数包含gse_${module}的进程信息
gse_master_pid_info=$(ps --no-header -C gse_${module} -o '%P' -o '|%p' -o '|%a' | awk -F'|' '$1 == 1 && $3 ~ /'gse_${module}'/' | awk -F'|' '{print $2}' | xargs)
gse_master_pid_info=$(ps --no-header -C gse_${module} -o 'ppid,pid,args' | awk '$1 == 1 && $3 ~ /'gse_${module}'/ {print $2}' | xargs)
read -r -a gse_agent_master_pids <<< "$gse_master_pid_info"

if [[ -z "$gse_agent_master_pids" ]]; then
Expand Down

0 comments on commit f7b4c32

Please sign in to comment.