diff --git a/README.md b/README.md index fa20285..292868a 100644 --- a/README.md +++ b/README.md @@ -11,4 +11,8 @@ A collection of useful scripts that I use everyday. - `moveFiles.sh` - This script checks to see if my server (friday) is online and the folders are mounted before moving files downloaded using rsync. - `copyfiles.sh` - Same as the above but it copies instead of moves the files. [Notes](https://www.alexhyett.com/notes/moving-files-with-rsync/) - `slackit.sh` - I use this to easily send slack notifications to myself from inside other scripts. [Notes](https://www.alexhyett.com/notes/send-slack-messages-with-a-command/) -- `sort_photos.py` - This file moves photos in my camera uploads folder into my main photos folder based on the date the photo was taken. [Notes](https://www.alexhyett.com/notes/sorting-photos-into-folders/) \ No newline at end of file +- `sort_photos.py` - This file moves photos in my camera uploads folder into my main photos folder based on the date the photo was taken. [Notes](https://www.alexhyett.com/notes/sorting-photos-into-folders/) +- `down.sh` - Runs `docker-compose down` on in all the nested folders under `directory` [Notes](https://www.alexhyett.com/notes/docker-scripts-for-nested-folders/) +- `up.sh` - Runs `docker-compose up -d` on in all the nested folders under `directory` [Notes](https://www.alexhyett.com/notes/docker-scripts-for-nested-folders/) +- `stop.sh` - Runs `docker-compose stop` on in all the nested folders under `directory` [Notes](https://www.alexhyett.com/notes/docker-scripts-for-nested-folders/) +- `start.sh` - Runs `docker-compose start` on in all the nested folders under `directory` [Notes](https://www.alexhyett.com/notes/docker-scripts-for-nested-folders/) \ No newline at end of file diff --git a/down.sh b/down.sh new file mode 100755 index 0000000..a9fc428 --- /dev/null +++ b/down.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Directory containing docker-compose files +directory="/media/data/jarvis/docker" + +# Loop through each subfolder +for subfolder in "$directory"/*; do + if [ -d "$subfolder" ]; then + cd "$subfolder" || exit + # Check if docker-compose.yml or docker-compose.yaml file exists + if [ -e "docker-compose.yml" ] || [ -e "docker-compose.yaml" ]; then + echo "Downing containers in $subfolder" + docker-compose down + else + echo "No docker-compose file found in $subfolder" + fi + fi +done \ No newline at end of file diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..7d1b612 --- /dev/null +++ b/start.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Directory containing docker-compose files +directory="/media/data/jarvis/docker" + +# Loop through each subfolder +for subfolder in "$directory"/*; do + if [ -d "$subfolder" ]; then + cd "$subfolder" || exit + # Check if docker-compose.yml or docker-compose.yaml file exists + if [ -e "docker-compose.yml" ] || [ -e "docker-compose.yaml" ]; then + echo "Starting containers in $subfolder" + docker-compose start + else + echo "No docker-compose file found in $subfolder" + fi + fi +done \ No newline at end of file diff --git a/stop.sh b/stop.sh new file mode 100755 index 0000000..f0d4cef --- /dev/null +++ b/stop.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Directory containing docker-compose files +directory="/media/data/jarvis/docker" + +# Loop through each subfolder +for subfolder in "$directory"/*; do + if [ -d "$subfolder" ]; then + cd "$subfolder" || exit + # Check if docker-compose.yml or docker-compose.yaml file exists + if [ -e "docker-compose.yml" ] || [ -e "docker-compose.yaml" ]; then + echo "Stopping containers in $subfolder" + docker-compose stop + else + echo "No docker-compose file found in $subfolder" + fi + fi +done \ No newline at end of file diff --git a/up.sh b/up.sh new file mode 100755 index 0000000..c0566d2 --- /dev/null +++ b/up.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Directory containing docker-compose files +directory="/media/data/jarvis/docker" + +# Loop through each subfolder +for subfolder in "$directory"/*; do + if [ -d "$subfolder" ]; then + cd "$subfolder" || exit + # Check if docker-compose.yml or docker-compose.yaml file exists + if [ -e "docker-compose.yml" ] || [ -e "docker-compose.yaml" ]; then + echo "Upping containers in $subfolder" + docker-compose up -d + else + echo "No docker-compose file found in $subfolder" + fi + fi +done \ No newline at end of file