Skip to content

Commit

Permalink
st2ctl: Force ps to use wide output to avoid truncation
Browse files Browse the repository at this point in the history
At least in GHA in some cases, the ps output is getting truncated,
possibly respecting our COLUMNS=120 env var. This adds ww to the ps command
to make it have unlimited width.
  • Loading branch information
cognifloyd committed Dec 12, 2024
1 parent d9f6f10 commit 84c5a9d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions st2common/bin/st2ctl
Original file line number Diff line number Diff line change
@@ -141,7 +141,7 @@ function service_manager() {
function reopen_component_log_files() {
COM=${1}

PID=`ps ax | grep -v grep | grep -v st2ctl | grep -E "(${COM}\.wsgi)|(bin/${COM})|(hubot .*${COM})" | awk '{print $1}'`
PID=`ps axww | grep -v grep | grep -v st2ctl | grep -E "(${COM}\.wsgi)|(bin/${COM})|(hubot .*${COM})" | awk '{print $1}'`
if [[ ! -z ${PID} ]]; then
for p in ${PID}; do
echo "Sending SIGUSR1 to ${COM} PID: ${p}"
@@ -200,11 +200,8 @@ function getpids() {
echo "##### st2 components status #####"
COMPONENTS=${COMPONENTS}

set -x
ps ax | grep -v grep | grep -v st2ctl
for COM in ${COMPONENTS}; do
ps ax | grep -v grep | grep -v st2ctl | grep -E "(${COM}\.wsgi)|(bin/${COM})|(hubot .*${COM})"
PID=`ps ax | grep -v grep | grep -v st2ctl | grep -E "(${COM}\.wsgi)|(bin/${COM})|(hubot .*${COM})" | awk '{print $1}'`
PID=`ps axww | grep -v grep | grep -v st2ctl | grep -E "(${COM}\.wsgi)|(bin/${COM})|(hubot .*${COM})" | awk '{print $1}'`

if [[ ! -z ${PID} ]]; then
for p in ${PID}; do
@@ -214,7 +211,6 @@ function getpids() {
echo "${COM} is not running."
fi
done
set +x
}


0 comments on commit 84c5a9d

Please sign in to comment.