修改部署脚本

This commit is contained in:
Tian jianyong 2024-12-20 18:54:50 +08:00
parent abb5c4b150
commit 96dfb198e3

View File

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