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

bugfix: 修复gsectl脚本获取进程启动时间重复问题 (closed #1870) #1871

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions script_tools/gsectl/agent/linux/gsectl
Original file line number Diff line number Diff line change
Expand Up @@ -641,18 +641,18 @@ get_process_runtime (){
# 找到了匹配的pid
# 获取进程pid的启动时间
PID=$_pid
START_TIME=$(ps -eo pid,lstart --sort -start_time | grep "$PID" | awk '{ print $2 " " $3 " " $4 " " $5 " " $6 }')
START_TIME=$(ps -p "$PID" -o lstart=)
START_TIME_S=$(date -d "$START_TIME" +%s)
CURRENT_TIME_S=$(date +%s)
TIME_DIFF=$(($CURRENT_TIME_S - $START_TIME_S))

if [ $TIME_DIFF -le 20 ]; then
echo "gse_agent -> $PID has been running for $TIME_DIFF seconds, check $i times"
p_status=0
p_status=0
break 2
else
echo "gse_agent -> $PID has been running for $TIME_DIFF seconds, restart not yet successful, check $i times"
sleep 1
sleep 1
fi
fi
done
Expand Down
2 changes: 1 addition & 1 deletion script_tools/gsectl/proxy/linux/gsectl
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ get_process_runtime (){
# 找到了匹配的pid
# 获取进程pid的启动时间
PID=$_pid
START_TIME=$(ps -eo pid,lstart --sort -start_time | grep "$PID" | awk '{ print $2 " " $3 " " $4 " " $5 " " $6 }')
START_TIME=$(ps -p "$PID" -o lstart=)
START_TIME_S=$(date -d "$START_TIME" +%s)
CURRENT_TIME_S=$(date +%s)
TIME_DIFF=$(($CURRENT_TIME_S - $START_TIME_S))
Expand Down