diff --git a/scripts/deploy.sh b/scripts/deploy.sh index e2c2840..f21be7e 100644 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -2,8 +2,8 @@ # Set up logging LOGFILE="/tmp/deploy.log" -exec 1> >(tee -a "$LOGFILE") -exec 2> >(tee -a "$LOGFILE" >&2) +# 重定向标准输出和错误输出到日志文件 +exec &> >(tee -a "$LOGFILE") # Color definitions for output RED='\033[0;31m' @@ -13,15 +13,15 @@ NC='\033[0m' # No Color # Logging functions log_info() { - echo -e "${GREEN}[INFO]${NC} $1" + echo -e "${GREEN}[INFO]${NC} $1" | tee -a "$LOGFILE" } log_warn() { - echo -e "${YELLOW}[WARN]${NC} $1" + echo -e "${YELLOW}[WARN]${NC} $1" | tee -a "$LOGFILE" } log_error() { - echo -e "${RED}[ERROR]${NC} $1" + echo -e "${RED}[ERROR]${NC} $1" | tee -a "$LOGFILE" } # Check if running as root @@ -69,7 +69,7 @@ if command -v getenforce &> /dev/null; then if [ "$selinux_status" = "Enforcing" ]; then log_info "Setting SELinux contexts..." - # 设置应用目录的 SELinux 上下文 + # 设置���用目录的 SELinux 上下文 log_info "Setting context for application directories..." chcon -R -t usr_t $WORK_DIR chcon -t bin_t $WORK_DIR/bin