File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,26 +30,39 @@ export O2_ROLE=${O2_ROLE:-}
3030
3131# ------ Beginning extra cleanup ------
3232n=0
33- for p in ` pgrep -u flp` ; do
33+ pids=$( pgrep -u flp)
34+
35+ # Try to kill any flp-owned processes gracefully
36+ for p in $pids ; do
3437 c=" ` ps -ho %c $p ` "
3538 [ " $c " = " o2-alf" ] && continue
3639 echo " Kill '%s' (PID:%s)\n" " ` date` " " ` hostname -s` " " $c " " $p " | $O2_INFOLOGGER_PATH /bin/o2-infologger-log -x -s Debug -o Facility=$O2_FACILITY -o Partition=$O2_PARTITION
3740 n=$(( n+ 1 ))
3841 kill $p
3942done
4043
44+ # Force kill any flp-owned processes remaining
4145if (( n > 0 )) ; then
4246
4347 sleep 5
4448
45- for p in ` pgrep -u flp ` ; do
49+ for p in $pids ; do
4650 c=" ` ps -ho %c $p ` "
4751 [ " $c " = " o2-alf" ] && continue
48- echo " Kill -9 '%s' (PID:%s)\n" " ` date` " " ` hostname -s` " " $c " " $p " | $O2_INFOLOGGER_PATH /bin/o2-infologger-log -x -s Debug -o Facility=$O2_FACILITY
52+ echo " Kill -9 '%s' (PID:%s)\n" " ` date` " " ` hostname -s` " " $c " " $p " | $O2_INFOLOGGER_PATH /bin/o2-infologger-log -x -s Debug -o Facility=$O2_FACILITY -o Partition= $O2_PARTITION
4953 kill -9 $p
5054 done
5155fi
5256
57+ # Ensure that no flp-owned processes remain before returning
58+ if (( n > 0 )) ; then
59+ for p in $pids ; do
60+ while [ kill -0 $p > /dev/null 2>&1 ]; do
61+ sleep 0.1
62+ done
63+ done
64+ fi
65+
5366rm -f /dev/shm/* fmq*
5467
5568yes | roc-cleanup --light > /dev/null 3>&1
You can’t perform that action at this time.
0 commit comments