Add command to restart all docker containers

This commit is contained in:
2022-08-29 20:22:57 +02:00
parent b48a5510b7
commit 26eb1df555
2 changed files with 32 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
#!/usr/bin/env bash
readonly = DOCKER_FOLDER="/srv/"
function ok()
{
echo -e "\e[32mdone\e[0m"
}
function failed()
{
echo -e "\e[31mfailed\e[0m"
}
function main() {
container_list=$(find "${DOCKER_FOLDER}" -mindepth 1 -maxdepth 1 -type d ! -iname "archives" ! -iname "images" ! -iname "lost+found")
for container_path in ${container_list}; do
cd "${container_path}"
docker compose down \
&& docker compose stop \
&& docker compose up -d
cd - &>/dev/null
done
}
main