修改部署脚本

This commit is contained in:
Tian jianyong 2024-12-20 18:56:45 +08:00
parent 96dfb198e3
commit 882de9d628

View File

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