Skip to content

Commit

Permalink
feat: tlinux4系统安装脚本及gsectl适配 (closed #2243)
Browse files Browse the repository at this point in the history
  • Loading branch information
Huayeaaa authored and wyyalt committed Aug 15, 2024
1 parent 85a5ce9 commit 0e2e4b2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ mistune==0.8.4
django-versionlog==1.6.0

# 腾讯云SDK
tencentcloud-sdk-python==3.0.151
tencentcloud-sdk-python==3.0.1210

# Iam SDK
bk-iam==1.1.14
Expand Down
4 changes: 2 additions & 2 deletions script_tools/agent_tools/agent2/setup_agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,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 -F'|' '$1 != 1 && $3 ~ /gse_agent/' | awk -F'|' '{print $2}' | xargs)"
read -r -a _pids <<< "$(ps --no-header -C $comm -o 'ppid,pid,args' | awk '$1 != 1 && $3 ~ /gse_agent/ {print $2}' | xargs)"
elif [[ "${worker}" == "MASTER" ]]; then
read -r -a _pids <<< "$(ps --no-header -C $comm -o '%P|%p|%a' | awk -F'|' '$1 == 1 && $3 ~ /gse_agent/' | awk -F'|' '{print $2}' | xargs)"
read -r -a _pids <<< "$(ps --no-header -C $comm -o 'ppid,pid,args' | awk '$1 == 1 && $3 ~ /gse_agent/ {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/agent/linux/gsectl
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ get_process_runtime (){

for i in {1..20}
do
tmp_gse_master_pid_info=$(ps --no-header -C gse_agent -o '%P' -o '|%p' -o '|%a' | awk -F'|' '$1 == 1 && $3 ~ /gse_agent/' | awk -F'|' '{print $2}' | xargs)
tmp_gse_master_pid_info=$(ps --no-header -C gse_agent -o 'ppid,pid,args' | awk '$1 == 1 && $3 ~ /gse_agent/ {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 @@ -666,7 +666,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 @@ -732,7 +732,7 @@ _status () {
# 初筛,考虑到gse组件的父、子进程都是名为gse_agent的,且它的父进程应该是等于1
# ps的-o参数指定输出字段%P(ppid)、%p(pid)、%a(args)
# 所以下面命令是拉出所有进程名为gse_agent,且父进程为1,进程参数包含gse_agent的进程信息
gse_master_pid_info=$(ps --no-header -C gse_agent -o '%P' -o '|%p' -o '|%a' | awk -F'|' '$1 == 1 && $3 ~ /gse_agent/' | awk -F'|' '{print $2}' | xargs)
gse_master_pid_info=$(ps --no-header -C gse_agent -o 'ppid,pid,args' | awk '$1 == 1 && $3 ~ /gse_agent/ {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 0e2e4b2

Please sign in to comment.