32 lines
1.2 KiB
Bash
Executable File
32 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# ファイルフルパス
|
|
INITIAL_DIR=$(pwd)
|
|
LOG_FILE="$INITIAL_DIR/logfile.log"
|
|
|
|
log_message() {
|
|
echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" | tee -a "$LOG_FILE"
|
|
}
|
|
# Docker dictation_client コンテナと dictation_server コンテナを停止
|
|
CONTAINER_EXISTS=$(docker ps -a --filter "name=dictation_server_dev_container" --format "{{.ID}}")
|
|
if [ -n "$CONTAINER_EXISTS" ]; then
|
|
log_message "Stopping existing Dev Container: $CONTAINER_EXIST..."
|
|
docker stop "$CONTAINER_EXISTS" >>"$LOG_FILE" 2>&1
|
|
if [ $? -ne 0 ]; then
|
|
log_message "ERROR: Failed to remove the Dev Container: $CONTAINER_EXIST."
|
|
exit 1
|
|
else
|
|
log_message "Dev Container: dictation_server removed successfully."
|
|
fi
|
|
fi
|
|
|
|
CONTAINER_EXISTS=$(docker ps -a --filter "name=dictation_client_devcontainer" --format "{{.ID}}")
|
|
if [ -n "$CONTAINER_EXISTS" ]; then
|
|
log_message "Stopping existing Dev Container: $CONTAINER_EXIST..."
|
|
docker stop "$CONTAINER_EXISTS" >>"$LOG_FILE" 2>&1
|
|
if [ $? -ne 0 ]; then
|
|
log_message "ERROR: Failed to remove the Dev Container: $CONTAINER_EXIST."
|
|
exit 1
|
|
else
|
|
log_message "Dev Container: dictation_client removed successfully."
|
|
fi
|
|
fi |