theocorp_docker_compose/restart_container.sh
2025-05-06 22:58:30 -04:00

31 lines
616 B
Bash
Executable File

#!/bin/bash
# Check if a value was provided
if [ -z "$1" ]; then
echo "Usage: $0 <value>"
exit 1
fi
# Use the provided argument
VALUE="$1"
TARGET_DIR="/home/geezo/docker_containers/$VALUE"
# Check if the directory exists
if [ ! -d "$TARGET_DIR" ]; then
echo "Error: Directory $TARGET_DIR does not exist."
exit 1
fi
# Pull the latest changes from the repository
cd /home/geezo/docker_containers/
git pull
# Navigate to the target directory
cd "$TARGET_DIR" || { echo "Failed to change directory to $TARGET_DIR"; exit 1; }
# Run Docker Compose commands
docker compose down
docker compose up -d