Skip to content

Commit 4d3c42e

Browse files
Removal of child processes (#2962)
* fixed permission matching logic * fixed permission matching logic * fixed permission matching logic * fixed permission matching logic * updated PAR URL * Added to support handling of stuck podman container * fixed lint * Update agentAutoUpdate.sh * Update agentAutoUpdate.sh * Update agentAutoUpdate.sh * Fixed handling of force removal of stuck podman containers in stopping state * Fixed handling of force removal of stuck podman containers in stopping state * Added Peoplesoft views definitions * Added Peoplesoft views definitions, updated readme and created versions * Added Peoplesoft views definitions, updated readme and created versions * Added fix to remove the child processed before terminating the parent process * Added fix to remove the child processed before terminating the parent process
1 parent 79df1ba commit 4d3c42e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

OracleIdentityGovernance/samples/scripts/agentManagement.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,19 @@ start()
696696
echo "INFO: You can monitor the agent ${AI} from the Access Governance Console."
697697
}
698698

699+
list_descendants ()
700+
{
701+
# shellcheck disable=SC3043,SC2155,SC2046
702+
local children=$(ps -o pid= --ppid "$1")
703+
704+
for pid in $children
705+
do
706+
list_descendants "$pid"
707+
done
708+
709+
echo "$children"
710+
}
711+
699712
forceStopPodman()
700713
{
701714
# Get the main process for the container.
@@ -705,6 +718,9 @@ if [ -n "${CONTAINER_ID}" ]; then
705718
CONTAINER_PROCESS_ID=$(ps -ef | grep -v grep | grep "$CONTAINER_ID" | awk '{print $2}')
706719
echo Container Process ID: ${CONTAINER_PROCESS_ID}
707720

721+
# shellcheck disable=SC2046
722+
kill -9 $(list_descendants ${CONTAINER_PROCESS_ID})
723+
708724
# Kill any processes containing the process ID.
709725
# This kills the child processes too.
710726
# shellcheck disable=SC2046
@@ -727,6 +743,9 @@ if [ -n "${CONTAINER_ID}" ]; then
727743
CONTAINER_PROCESS_ID=$(ps -ef | grep -v grep | grep "$CONTAINER_ID" | awk '{print $2}')
728744
echo Container Process ID: ${CONTAINER_PROCESS_ID}
729745

746+
# shellcheck disable=SC2046
747+
kill -9 $(list_descendants ${CONTAINER_PROCESS_ID})
748+
730749
# Kill any processes containing the process ID.
731750
# This kills the child processes too.
732751
# shellcheck disable=SC2046

0 commit comments

Comments
 (0)