linux-tutorial/codes/linux/soft/rocketmq-install.sh

60 lines
1.7 KiB
Bash
Raw Normal View History

2019-05-07 15:04:19 +08:00
#!/usr/bin/env bash
2019-07-12 15:53:54 +08:00
###################################################################################
# 控制台颜色
BLACK="\033[1;30m"
RED="\033[1;31m"
GREEN="\033[1;32m"
YELLOW="\033[1;33m"
BLUE="\033[1;34m"
PURPLE="\033[1;35m"
CYAN="\033[1;36m"
RESET="$(tput sgr0)"
###################################################################################
printf "${BLUE}"
2019-05-07 15:04:19 +08:00
cat << EOF
###################################################################################
# 安装 rocketmq 脚本
# @system: 适用于所有 linux 发行版本。
# @author: Zhang Peng
###################################################################################
EOF
2019-07-12 15:53:54 +08:00
printf "${RESET}"
printf "${GREEN}>>>>>>>> install tomcat begin.${RESET}\n"
2019-05-07 15:04:19 +08:00
2019-10-10 08:56:31 +08:00
if [[ $# -lt 1 ]] || [[ $# -lt 2 ]]; then
2019-10-29 18:22:19 +08:00
printf "${PURPLE}[Hint]\n"
printf "\t sh rocketmq-install.sh [version] [path]\n"
printf "\t Example: sh rocketmq-install.sh 4.5.0 /opt/rocketmq\n"
printf "${RESET}\n"
2019-05-09 11:26:06 +08:00
fi
2019-05-07 15:04:19 +08:00
version=4.5.0
if [[ -n $1 ]]; then
2019-10-29 18:22:19 +08:00
version=$1
2019-05-07 15:04:19 +08:00
fi
2019-07-12 15:53:54 +08:00
path=/opt/rocketmq
2019-05-07 15:04:19 +08:00
if [[ -n $2 ]]; then
2019-10-29 18:22:19 +08:00
path=$2
2019-05-07 15:04:19 +08:00
fi
2019-07-12 15:53:54 +08:00
# install info
printf "${PURPLE}[Info]\n"
printf "\t version = ${version}\n"
printf "\t path = ${path}\n"
printf "${RESET}\n"
# download and decompression
mkdir -p ${path}
curl -o ${path}/rocketmq-all-${version}-bin-release.zip http://mirrors.tuna.tsinghua.edu.cn/apache/rocketmq/${version}/rocketmq-all-${version}-bin-release.zip
unzip -o ${path}/rocketmq-all-${version}-bin-release.zip -d ${path}/rocketmq-all-${version}/
mv ${path}/rocketmq-all-${version}/rocketmq-all-${version}-bin-release/* ${path}/rocketmq-all-${version}
rm -rf ${path}/rocketmq-all-${version}/rocketmq-all-${version}-bin-release
2019-05-07 15:04:19 +08:00
2019-07-12 15:53:54 +08:00
printf "${GREEN}<<<<<<<< install rocketmq end.${RESET}\n"