refactor: 整理 installer 脚本的输出信息

This commit is contained in:
xuwei-fit2cloud 2024-02-07 14:38:18 +08:00
parent f9bc0f84b7
commit d604c3b464
3 changed files with 23 additions and 15 deletions

View File

@ -286,7 +286,7 @@ function upgrade() {
exit 1
fi
tar zxvf $installer_file
tar zxf $installer_file
if [ $? != 0 ]; then
echo "下载在线安装包失败,请试试重新执行一次安装命令。"
rm -f $installer_file

View File

@ -5,6 +5,8 @@ CURRENT_DIR=$(
pwd
)
echo "$(date)" | tee -a ${CURRENT_DIR}/install.log
function log() {
message="[DATAEASE Log]: $1 "
echo -e "${message}" 2>&1 | tee -a ${CURRENT_DIR}/install.log
@ -102,9 +104,7 @@ if [ ! -f /usr/bin/dectl ]; then
ln -s /usr/local/bin/dectl /usr/bin/dectl 2>/dev/null
fi
echo "time: $(date)"
if which getenforce && [ $(getenforce) == "Enforcing" ];then
if which getenforce >/dev/null 2>&1 && [ $(getenforce) == "Enforcing" ];then
log "... 关闭 SELINUX"
setenforce 0
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
@ -115,7 +115,7 @@ fi
if which docker >/dev/null 2>&1; then
log "检测到 Docker 已安装,跳过安装步骤"
log "启动 Docker "
service docker start 2>&1 | tee -a ${CURRENT_DIR}/install.log
service docker start >/dev/null 2>&1 | tee -a ${CURRENT_DIR}/install.log
else
if [[ -d docker ]]; then
log "... 离线安装 docker"
@ -203,8 +203,11 @@ else
cd -
fi
if which chkconfig;then
chkconfig --del dataease
if which chkconfig >/dev/null 2>&1;then
chkconfig dataease >/dev/null
if [ $? -eq 0 ]; then
chkconfig --del dataease
fi
fi
if [[ -f /etc/init.d/dataease ]];then
rm -f /etc/init.d/dataease
@ -213,7 +216,7 @@ log "配置 dataease Service"
cp ${DE_RUN_BASE}/bin/dataease/dataease.service /etc/systemd/system/
chmod 644 /etc/systemd/system/dataease.service
log "配置开机自启动"
systemctl enable dataease; systemctl daemon-reload 2>&1 | tee -a ${CURRENT_DIR}/install.log
systemctl enable dataease >/dev/null 2>&1; systemctl daemon-reload | tee -a ${CURRENT_DIR}/install.log
if [[ $(grep "vm.max_map_count" /etc/sysctl.conf | wc -l) -eq 0 ]];then
sysctl -w vm.max_map_count=2000000
@ -230,7 +233,7 @@ else
sed -i 's/^net\.ipv4\.ip_forward.*/net\.ipv4\.ip_forward=1/' /etc/sysctl.conf
fi
if which firewall-cmd >/dev/null; then
if which firewall-cmd >/dev/null 2>&1; then
if systemctl is-active firewalld &>/dev/null ;then
log "防火墙端口开放"
firewall-cmd --zone=public --add-port=${DE_PORT}/tcp --permanent
@ -254,4 +257,4 @@ if [[ $DE_INSTALL_MODE != "community" ]];then
access_port=9080
fi
echo -e "======================= 安装完成 =======================\n" 2>&1 | tee -a ${CURRENT_DIR}/install.log
echo -e "系统登录信息如下:\n 访问地址: http://服务器IP:$access_port\n 用户名: admin\n 初始密码: DataEase@123456" 2>&1 | tee -a ${CURRENT_DIR}/install.log
echo -e "系统登录信息如下:\n\t访问地址: http://服务器IP:$access_port\n\t用户名: admin\n\t初始密码: DataEase@123456" 2>&1 | tee -a ${CURRENT_DIR}/install.log

View File

@ -20,15 +20,18 @@ case $input in
esac
echo "停止 DataEase 服务"
service dataease stop
service dataease stop >/dev/null 2>&1
echo "移除 DataEase 服务"
if which chkconfig;then
chkconfig --del dataease
if which chkconfig >/dev/null 2>&1;then
chkconfig dataease >/dev/null
if [ $? -eq 0 ]; then
chkconfig --del dataease >/dev/null 2>&1
fi
fi
if [ -f /etc/systemd/system/dataease.service ];then
systemctl disable dataease
systemctl disable dataease >/dev/null 2>&1
rm -f /etc/systemd/system/dataease.service
systemctl daemon-reload
elif [[ -f /etc/init.d/dataease ]];then
@ -52,4 +55,6 @@ if test -n "$(docker images | grep 'registry.cn-qingdao.aliyuncs.com/dataease')"
fi
# 清理 DataEase 运行目录及命令行工具 dectl
rm -rf ${DE_BASE}/dataease2.0 /usr/bin/dectl
rm -rf ${DE_BASE}/dataease2.0 /usr/bin/dectl
echo "DataEase 服务卸载完成"