LaravelPublisher/restart.sh

30 lines
608 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.

#!/bin/bash
WIPE=false
if [ "$1" == "--wipe" ]; then
WIPE=true
fi
# 載入 .env 中的變數
if [ -f .env ]; then
export $(grep -v '^#' .env | xargs)
echo "📦 .env 載入完成"
else
echo "❌ 沒有找到 .env無法載入環境變數"
exit 1
fi
# 使用 .env 中的 APP_NAME 作為 project name
PROJECT_NAME="${APP_NAME}"
echo "♻️ 正在重新啟動 $PROJECT_NAME 所有服務..."
# 先停服務
echo "🔻 執行 stop.sh..."
./stop.sh $([ "$WIPE" == "true" ] && echo "--wipe")
# 再啟動服務
echo "🔺 執行 start.sh..."
./start.sh
echo "$PROJECT_NAME 已完成重啟!"