Skip to content

Commit 993b3ee

Browse files
mconcasjustonedev1
authored andcommitted
[shmcleaner] Read process names from /proc instead of ps
The o2-alf exclusion compares the output of `ps -ho %c <pid>` with the literal string `o2-alf`. On RHEL 10 that command pads the name to 15 columns, so the comparison never matches and the cleanup SIGTERMs ALF before every DEPLOY. `systemd` treats SIGTERM as a clean exit and `Restart=on-failure` leaves the service down. EL9 prints the bare name, which is why production was not affected. Read `/proc/<pid>/comm` directly: same kernel field, not intermediate.
1 parent ea00053 commit 993b3ee

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎o2-aliecs-shmcleaner‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ memStart="`grep MemAvailable /proc/meminfo | sed 's/.*: *//'`"
3939
# Try to kill leftover processes gracefully
4040
n=0
4141
for p in `pgrep -u flp`; do
42-
c="`ps -ho %c $p`"
42+
c="`cat /proc/$p/comm 2>/dev/null`"
4343
[ "$c" = "o2-alf" ] && continue
4444
[ "$c" ] || continue
4545
echo "Killing '$c' PID:$p" | $O2_INFOLOGGER_PATH/bin/o2-infologger-log -x -s Debug -o Facility=$O2_FACILITY -o Partition=$O2_PARTITION
@@ -50,7 +50,7 @@ done
5050
# Check if all cleaned
5151
w=""
5252
for p in `pgrep -u flp`; do
53-
c="`ps -ho %c $p`"
53+
c="`cat /proc/$p/comm 2>/dev/null`"
5454
[ "$c" = "o2-alf" ] && continue
5555
[ "$c" ] || continue
5656
w="T"
@@ -61,7 +61,7 @@ nn=0
6161
if [ "$w" = "T" ]; then
6262
sleep ${waitFor}
6363
for p in `pgrep -u flp`; do
64-
c="`ps -ho %c $p`"
64+
c="`cat /proc/$p/comm 2>/dev/null`"
6565
[ "$c" = "o2-alf" ] && continue
6666
[ "$c" ] || continue
6767
echo "Killing -9 '$c' PID:$p" | $O2_INFOLOGGER_PATH/bin/o2-infologger-log -x -s Debug -o Facility=$O2_FACILITY -o Partition=$O2_PARTITION
@@ -76,7 +76,7 @@ while true; do
7676
l=""
7777
x=0
7878
for p in `pgrep -u flp`; do
79-
c="`ps -ho %c $p`"
79+
c="`cat /proc/$p/comm 2>/dev/null`"
8080
[ "$c" = "o2-alf" ] && continue
8181
[ "$c" ] || continue
8282
l="$l'$c':$p "

0 commit comments

Comments
 (0)