From 22c3dd7ce794a7c3b4f137235af3f5823ec4f26d Mon Sep 17 00:00:00 2001 From: Matteo Concas Date: Fri, 23 Oct 2026 17:17:20 +0200 Subject: [PATCH] [shmcleaner] Read process names from /proc instead of ps The o2-alf exclusion compares the output of `ps -ho %c ` 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//comm` directly: same kernel field, not intermediate. --- o2-aliecs-shmcleaner | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/o2-aliecs-shmcleaner b/o2-aliecs-shmcleaner index e2358e8e6..7bf5295d8 100644 --- a/o2-aliecs-shmcleaner +++ b/o2-aliecs-shmcleaner @@ -39,7 +39,7 @@ memStart="`grep MemAvailable /proc/meminfo | sed 's/.*: *//'`" # Try to kill leftover processes gracefully n=0 for p in `pgrep -u flp`; do - c="`ps -ho %c $p`" + c="`cat /proc/$p/comm 2>/dev/null`" [ "$c" = "o2-alf" ] && continue [ "$c" ] || continue 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 # Check if all cleaned w="" for p in `pgrep -u flp`; do - c="`ps -ho %c $p`" + c="`cat /proc/$p/comm 2>/dev/null`" [ "$c" = "o2-alf" ] && continue [ "$c" ] || continue w="T" @@ -61,7 +61,7 @@ nn=0 if [ "$w" = "T" ]; then sleep ${waitFor} for p in `pgrep -u flp`; do - c="`ps -ho %c $p`" + c="`cat /proc/$p/comm 2>/dev/null`" [ "$c" = "o2-alf" ] && continue [ "$c" ] || continue 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 l="" x=0 for p in `pgrep -u flp`; do - c="`ps -ho %c $p`" + c="`cat /proc/$p/comm 2>/dev/null`" [ "$c" = "o2-alf" ] && continue [ "$c" ] || continue l="$l'$c':$p "