diff --git a/installer/dataease/dectl b/installer/dataease/dectl index 8c5cbc1757..d27e715591 100755 --- a/installer/dataease/dectl +++ b/installer/dataease/dectl @@ -282,7 +282,7 @@ function upgrade() { exit 1 fi - tar zxvf dataease-${latest_version}-online.tar.gz + tar zxf dataease-${latest_version}-online.tar.gz if [ $? != 0 ];then echo "下载在线安装包失败,请试试重新执行一次安装命令。" rm -f dataease-${latest_version}-online.tar.gz diff --git a/installer/dataease/install.sh b/installer/dataease/install.sh index fa13bf4b85..ea2c763095 100755 --- a/installer/dataease/install.sh +++ b/installer/dataease/install.sh @@ -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 @@ -211,9 +213,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 @@ -224,7 +224,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" @@ -233,7 +233,7 @@ else chmod +x /usr/bin/docker* chmod 644 /etc/systemd/system/docker.service log "... 启动 docker" - systemctl enable docker; systemctl daemon-reload; service docker start 2>&1 | tee -a ${CURRENT_DIR}/install.log + systemctl enable docker >/dev/null 2>&1; systemctl daemon-reload; service docker start >/dev/null 2>&1 | tee -a ${CURRENT_DIR}/install.log else log "... 在线安装 docker" curl -fsSL https://resource.fit2cloud.com/get-docker-linux.sh -o get-docker.sh 2>&1 | tee -a ${CURRENT_DIR}/install.log @@ -243,7 +243,7 @@ else fi sudo sh get-docker.sh 2>&1 | tee -a ${CURRENT_DIR}/install.log log "... 启动 docker" - systemctl enable docker; systemctl daemon-reload; service docker start 2>&1 | tee -a ${CURRENT_DIR}/install.log + systemctl enable docker >/dev/null 2>&1; systemctl daemon-reload; service docker start >/dev/null 2>&1 | tee -a ${CURRENT_DIR}/install.log fi if [ ! -d "$docker_config_folder" ];then @@ -283,7 +283,7 @@ if [ $? -ne 0 ]; then fi fi - docker-compose version >/dev/null + docker-compose version >/dev/null 2>&1 if [ $? -ne 0 ]; then log "docker-compose 安装失败" exit 1 @@ -316,8 +316,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 @@ -328,7 +331,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 @@ -345,7 +348,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 @@ -365,4 +368,4 @@ log "启动服务" systemctl start dataease 2>&1 | tee -a ${CURRENT_DIR}/install.log echo -e "======================= 安装完成 =======================\n" 2>&1 | tee -a ${CURRENT_DIR}/install.log -echo -e "请通过以下方式访问:\n URL: http://\$LOCAL_IP:$DE_PORT\n 用户名: admin\n 初始密码: dataease" 2>&1 | tee -a ${CURRENT_DIR}/install.log +echo -e "请通过以下方式访问:\n\tURL: http://\$LOCAL_IP:$DE_PORT\n\t用户名: admin\n\t初始密码: dataease" 2>&1 | tee -a ${CURRENT_DIR}/install.log diff --git a/installer/dataease/uninstall.sh b/installer/dataease/uninstall.sh index e226ba296f..165558365e 100644 --- a/installer/dataease/uninstall.sh +++ b/installer/dataease/uninstall.sh @@ -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 @@ -40,9 +43,6 @@ if [ -f /usr/bin/dectl ]; then DE_BASE=$(grep "^DE_BASE=" /usr/bin/dectl | cut -d'=' -f2) fi -echo "停止 DataEase 服务" -dectl uninstall - # 清理 DataEase 相关镜像 if test ! -z "$(docker images -f dangling=true -q)"; then echo "清理虚悬镜像" @@ -55,4 +55,6 @@ if test -n "$(docker images | grep 'registry.cn-qingdao.aliyuncs.com/dataease')" fi # 清理 DataEase 运行目录及命令行工具 dectl -rm -rf ${DE_BASE}/dataease /usr/local/bin/dectl /usr/bin/dectl \ No newline at end of file +rm -rf ${DE_BASE}/dataease /usr/local/bin/dectl /usr/bin/dectl + +echo "DataEase 服务卸载完成" \ No newline at end of file