remove unnecessary check for setup process

autoheal was copied from kenya-emr and was still checking for a setup.pid file
and process. This won't do any harm but also does not add value.
This commit is contained in:
2024-04-03 16:28:04 -07:00
parent 9cbefc841f
commit cb4c6b4c1a
@@ -18,25 +18,20 @@ trap exit INT
# run at fixed interval, checking for and restarting any service marked as 'unhealthy' # run at fixed interval, checking for and restarting any service marked as 'unhealthy'
pushd $LOCATION > /dev/null pushd $LOCATION > /dev/null
while [ 1 ]; do while [ 1 ]; do
# get current state (running or not) and status (healthy, unhealthy, etc)
app_state=$(docker compose ps --format '{{.State}}' streamline-emr)
app_status=$(docker compose ps --format '{{.Status}}' streamline-emr)
# if setup is not running, make sure containers are active and running # check if app is running and healhty
if ! kill -0 $(cat ${LOCATION}/setup.pid 2> /dev/null) 2> /dev/null; then if [ "${app_state}" = "running" ]; then
if [[ "${app_status}" = *\(unhealthy\) ]]; then
# get current state (running or not) and status (healthy, unhealthy, etc) echo "Unhealthy service detected. Restarting 'streamline-emr'"
app_state=$(docker compose ps --format '{{.State}}' streamline-emr) docker compose restart streamline-emr
app_status=$(docker compose ps --format '{{.Status}}' streamline-emr)
# check if app is running and healhty
if [ "${app_state}" = "running" ]; then
if [[ "${app_status}" = *\(unhealthy\) ]]; then
echo "Unhealthy service detected. Restarting 'streamline-emr'"
docker compose restart streamline-emr
fi
# app should be running - restart
else
echo "Container not running. Starting 'streamline-emr'"
docker compose up -d streamline-emr
fi fi
# app should be running - restart
else
echo "Container not running. Starting 'streamline-emr'"
docker compose up -d streamline-emr
fi fi
# wait a little while before checking again # wait a little while before checking again