Skip to content
Merged
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions OracleIdentityGovernance/samples/scripts/agentManagement.sh
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,27 @@ else
fi
}

forceRmPodman()
{
# Get the main process for the container.
CONTAINER_ID=$(podman ps -a | grep "$AI" | awk '{print $1}')
if [ -n "${CONTAINER_ID}" ]; then
echo Container ID : "$CONTAINER_ID"
CONTAINER_PROCESS_ID=$(ps -ef | grep -v grep | grep "$CONTAINER_ID" | awk '{print $2}')
echo Container Process ID: ${CONTAINER_PROCESS_ID}

# Kill any processes containing the process ID.
# This kills the child processes too.
kill -9 `ps -ef | grep -v grep | grep ${CONTAINER_PROCESS_ID} | awk '{print $2}'`

# Stop the container, as Podman doesn't notice the processes are dead until you interact with the container.
echo "Removing container. Ignore errors."
podman rm -f "$AI"
else
echo "Container Already Removed"
fi
}

# shellcheck source=/dev/null
stop()
{
Expand Down Expand Up @@ -779,6 +800,7 @@ kill()
podman exec "$AI" /bin/bash -c 'agent --config /app/data/conf/config.json ido lcm -i status_check; while [[ "$?" != "2" && "$?" != "255" ]]; do sleep 5s;agent --config /app/data/conf/config.json ido lcm -i status_check; done' >/dev/null
fi
podman rm -f "$AI"
forceRmPodman
fi
}

Expand Down