Files
gangyan/scripts/mysql-restart.sh

15 lines
628 B
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# 须用 bash 执行;若误用 sh/dash 会自动改用 bash 再跑一遍
[ -n "${BASH_VERSION:-}" ] || exec /usr/bin/env bash "$0" ${1+"$@"}
# 重启 MySQL 8.4docker compose 目录gangyan/mysql/mysql-8.4.4
# 日志gangyan/logs/mysql.log
set -u
source "$(cd "$(dirname "$0")" && pwd)/common-restart.sh"
LOG_FILE="$LOG_DIR/mysql.log"
log_tee "======== 重启 MySQL ========"
cd "$GANGYAN_ROOT/mysql/mysql-8.4.4"
docker compose restart 2>&1 | tee -a "$LOG_FILE" || docker compose up -d 2>&1 | tee -a "$LOG_FILE"
log_tee "完成。docker compose ps ->"
docker compose ps 2>&1 | tee -a "$LOG_FILE"