If there are no apps installed, the stop script won't fail anymore.

This commit is contained in:
dextreem 2022-09-21 07:58:50 +02:00
parent eb08dd4021
commit ddbc0df7e6

View file

@ -23,17 +23,21 @@ cd "$ROOT_FOLDER"
export DOCKER_CLIENT_TIMEOUT=240
export COMPOSE_HTTP_TIMEOUT=240
# Get all app names from the apps folder
# Stop all installed apps if there are any
apps_folder="${ROOT_FOLDER}/apps"
apps_names=($(ls -d ${apps_folder}/*/ | xargs -n 1 basename | sed 's/\///g'))
if [ "$(find ${apps_folder} -maxdepth 1 -type d | wc -l)" -gt 1 ]; then
apps_names=($(ls -d ${apps_folder}/*/ | xargs -n 1 basename | sed 's/\///g'))
for app_name in "${apps_names[@]}"; do
# if folder ${ROOT_FOLDER}/app-data/app_name exists, then stop app
if [[ -d "${ROOT_FOLDER}/app-data/${app_name}" ]]; then
echo "Stopping ${app_name}"
"${ROOT_FOLDER}/scripts/app.sh" stop $app_name
fi
done
for app_name in "${apps_names[@]}"; do
# if folder ${ROOT_FOLDER}/app-data/app_name exists, then stop app
if [[ -d "${ROOT_FOLDER}/app-data/${app_name}" ]]; then
echo "Stopping ${app_name}"
"${ROOT_FOLDER}/scripts/app.sh" stop $app_name
fi
done
else
echo "No app installed that can be stopped."
fi
echo "Stopping Docker services..."
echo