Merge pull request #23303 from taosdata/packaging/TD-26637-main
update script
This commit is contained in:
commit
e73b969fc6
|
@ -373,42 +373,52 @@ function add_newHostname_to_hosts() {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
${csudo}echo "127.0.0.1 $1" >>/etc/hosts || :
|
|
||||||
|
if grep -q "127.0.0.1 $1" /etc/hosts; then
|
||||||
|
return
|
||||||
|
else
|
||||||
|
${csudo}echo "127.0.0.1 $1" >>/etc/hosts
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_hostname() {
|
function set_hostname() {
|
||||||
echo -e -n "${GREEN}Please enter one hostname(must not be 'localhost')${NC}:"
|
echo -e -n "${GREEN}Enter the public accessible IP address or fully qualified domain name TDengine will expose to users or applications (must not be 'localhost') :${NC}"
|
||||||
read newHostname
|
read newHostname
|
||||||
while true; do
|
while true; do
|
||||||
if [[ ! -z "$newHostname" && "$newHostname" != "localhost" ]]; then
|
if [[ ! -z "$newHostname" && "$newHostname" != "localhost" ]]; then
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
read -p "Please enter one hostname(must not be 'localhost'):" newHostname
|
echo -e -n "${GREEN}Enter the public accessible IP address or fully qualified domain name TDengine will expose to users or applications (must not be 'localhost') :${NC}"
|
||||||
|
read newHostname
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
${csudo}hostname $newHostname || :
|
# ${csudo}hostname $newHostname || :
|
||||||
retval=$(echo $?)
|
# retval=$(echo $?)
|
||||||
if [[ $retval != 0 ]]; then
|
# if [[ $retval != 0 ]]; then
|
||||||
echo
|
# echo
|
||||||
echo "set hostname fail!"
|
# echo "set hostname fail!"
|
||||||
return
|
# return
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
#ubuntu/centos /etc/hostname
|
# #ubuntu/centos /etc/hostname
|
||||||
if [[ -e /etc/hostname ]]; then
|
# if [[ -e /etc/hostname ]]; then
|
||||||
${csudo}echo $newHostname >/etc/hostname || :
|
# ${csudo}echo $newHostname >/etc/hostname || :
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
#debian: #HOSTNAME=yourname
|
# #debian: #HOSTNAME=yourname
|
||||||
if [[ -e /etc/sysconfig/network ]]; then
|
# if [[ -e /etc/sysconfig/network ]]; then
|
||||||
${csudo}sed -i -r "s/#*\s*(HOSTNAME=\s*).*/\1$newHostname/" /etc/sysconfig/network || :
|
# ${csudo}sed -i -r "s/#*\s*(HOSTNAME=\s*).*/\1$newHostname/" /etc/sysconfig/network || :
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$newHostname/" ${cfg_install_dir}/${configFile2}
|
if [ -f ${cfg_install_dir}/${configFile2} ]; then
|
||||||
|
${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$newHostname/" ${cfg_install_dir}/${configFile2}
|
||||||
|
else
|
||||||
|
${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$newHostname/" ${script_dir}/cfg/${configFile2}
|
||||||
|
fi
|
||||||
serverFqdn=$newHostname
|
serverFqdn=$newHostname
|
||||||
|
|
||||||
if [[ -e /etc/hosts ]]; then
|
if [[ -e /etc/hosts ]] && [[ ! $newHostname =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
|
||||||
add_newHostname_to_hosts $newHostname
|
add_newHostname_to_hosts $newHostname
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -439,7 +449,12 @@ function set_ipAsFqdn() {
|
||||||
echo -e -n "${GREEN}Unable to get local ip, use 127.0.0.1${NC}"
|
echo -e -n "${GREEN}Unable to get local ip, use 127.0.0.1${NC}"
|
||||||
localFqdn="127.0.0.1"
|
localFqdn="127.0.0.1"
|
||||||
# Write the local FQDN to configuration file
|
# Write the local FQDN to configuration file
|
||||||
${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/${configFile2}
|
|
||||||
|
if [ -f ${cfg_install_dir}/${configFile2} ]; then
|
||||||
|
${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/${configFile2}
|
||||||
|
else
|
||||||
|
${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${script_dir}/cfg/${configFile2}
|
||||||
|
fi
|
||||||
serverFqdn=$localFqdn
|
serverFqdn=$localFqdn
|
||||||
echo
|
echo
|
||||||
return
|
return
|
||||||
|
@ -460,8 +475,12 @@ function set_ipAsFqdn() {
|
||||||
if [[ $retval != 0 ]]; then
|
if [[ $retval != 0 ]]; then
|
||||||
read -p "Please choose an IP from local IP list:" localFqdn
|
read -p "Please choose an IP from local IP list:" localFqdn
|
||||||
else
|
else
|
||||||
# Write the local FQDN to configuration file
|
# Write the local FQDN to configuration file
|
||||||
${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/${configFile2}
|
if [ -f ${cfg_install_dir}/${configFile2} ]; then
|
||||||
|
${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/${configFile2}
|
||||||
|
else
|
||||||
|
${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${script_dir}/cfg/${configFile2}
|
||||||
|
fi
|
||||||
serverFqdn=$localFqdn
|
serverFqdn=$localFqdn
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
@ -476,37 +495,13 @@ function local_fqdn_check() {
|
||||||
echo
|
echo
|
||||||
echo -e -n "System hostname is: ${GREEN}$serverFqdn${NC}"
|
echo -e -n "System hostname is: ${GREEN}$serverFqdn${NC}"
|
||||||
echo
|
echo
|
||||||
if [[ "$serverFqdn" == "" ]] || [[ "$serverFqdn" == "localhost" ]]; then
|
set_hostname
|
||||||
echo -e -n "${GREEN}It is strongly recommended to configure a hostname for this machine ${NC}"
|
|
||||||
echo
|
|
||||||
|
|
||||||
while true; do
|
|
||||||
read -r -p "Set hostname now? [Y/n] " input
|
|
||||||
if [ ! -n "$input" ]; then
|
|
||||||
set_hostname
|
|
||||||
break
|
|
||||||
else
|
|
||||||
case $input in
|
|
||||||
[yY][eE][sS] | [yY])
|
|
||||||
set_hostname
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
|
|
||||||
[nN][oO] | [nN])
|
|
||||||
set_ipAsFqdn
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
echo "Invalid input..."
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_adapter_config() {
|
function install_adapter_config() {
|
||||||
|
if [ -f ${script_dir}/cfg/${adapterName}.toml ]; then
|
||||||
|
${csudo}sed -i -r "s/localhost/${serverFqdn}/g" ${script_dir}/cfg/${adapterName}.toml
|
||||||
|
fi
|
||||||
if [ ! -f "${cfg_install_dir}/${adapterName}.toml" ]; then
|
if [ ! -f "${cfg_install_dir}/${adapterName}.toml" ]; then
|
||||||
${csudo}mkdir -p ${cfg_install_dir}
|
${csudo}mkdir -p ${cfg_install_dir}
|
||||||
[ -f ${script_dir}/cfg/${adapterName}.toml ] && ${csudo}cp ${script_dir}/cfg/${adapterName}.toml ${cfg_install_dir}
|
[ -f ${script_dir}/cfg/${adapterName}.toml ] && ${csudo}cp ${script_dir}/cfg/${adapterName}.toml ${cfg_install_dir}
|
||||||
|
@ -525,11 +520,19 @@ function install_adapter_config() {
|
||||||
|
|
||||||
function install_config() {
|
function install_config() {
|
||||||
|
|
||||||
|
local_fqdn_check
|
||||||
|
|
||||||
if [ ! -f "${cfg_install_dir}/${configFile2}" ]; then
|
if [ ! -f "${cfg_install_dir}/${configFile2}" ]; then
|
||||||
${csudo}mkdir -p ${cfg_install_dir}
|
${csudo}mkdir -p ${cfg_install_dir}
|
||||||
[ -f ${script_dir}/cfg/${configFile2} ] && ${csudo}cp ${script_dir}/cfg/${configFile2} ${cfg_install_dir}
|
if [ -f ${script_dir}/cfg/${configFile2} ]; then
|
||||||
|
${csudo} echo "monitor 1" >> ${script_dir}/cfg/${configFile2}
|
||||||
|
${csudo} echo "monitorFQDN ${serverFqdn}" >> ${script_dir}/cfg/${configFile2}
|
||||||
|
${csudo}cp ${script_dir}/cfg/${configFile2} ${cfg_install_dir}
|
||||||
|
fi
|
||||||
${csudo}chmod 644 ${cfg_install_dir}/*
|
${csudo}chmod 644 ${cfg_install_dir}/*
|
||||||
else
|
else
|
||||||
|
${csudo} echo "monitor 1" >> ${script_dir}/cfg/${configFile2}
|
||||||
|
${csudo} echo "monitorFQDN ${serverFqdn}" >> ${script_dir}/cfg/${configFile2}
|
||||||
${csudo}cp -f ${script_dir}/cfg/${configFile2} ${cfg_install_dir}/${configFile2}.new
|
${csudo}cp -f ${script_dir}/cfg/${configFile2} ${cfg_install_dir}/${configFile2}.new
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -537,15 +540,15 @@ function install_config() {
|
||||||
|
|
||||||
[ ! -z $1 ] && return 0 || : # only install client
|
[ ! -z $1 ] && return 0 || : # only install client
|
||||||
|
|
||||||
if ((${update_flag} == 1)); then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$interactiveFqdn" == "no" ]; then
|
# if ((${update_flag} == 1)); then
|
||||||
return 0
|
# return 0
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
local_fqdn_check
|
# if [ "$interactiveFqdn" == "no" ]; then
|
||||||
|
# return 0
|
||||||
|
# fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo -e -n "${GREEN}Enter FQDN:port (like h1.${emailName2}:6030) of an existing ${productName2} cluster node to join${NC}"
|
echo -e -n "${GREEN}Enter FQDN:port (like h1.${emailName2}:6030) of an existing ${productName2} cluster node to join${NC}"
|
||||||
|
@ -554,7 +557,11 @@ function install_config() {
|
||||||
read firstEp
|
read firstEp
|
||||||
while true; do
|
while true; do
|
||||||
if [ ! -z "$firstEp" ]; then
|
if [ ! -z "$firstEp" ]; then
|
||||||
${csudo}sed -i -r "s/#*\s*(firstEp\s*).*/\1$firstEp/" ${cfg_install_dir}/${configFile2}
|
if [ -f ${cfg_install_dir}/${configFile2} ]; then
|
||||||
|
${csudo}sed -i -r "s/#*\s*(firstEp\s*).*/\1$firstEp/" ${cfg_install_dir}/${configFile2}
|
||||||
|
else
|
||||||
|
${csudo}sed -i -r "s/#*\s*(firstEp\s*).*/\1$firstEp/" ${script_dir}/cfg/${configFile2}
|
||||||
|
fi
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
|
@ -629,7 +636,7 @@ function install_taosx() {
|
||||||
if [ -f "${script_dir}/taosx/install_taosx.sh" ]; then
|
if [ -f "${script_dir}/taosx/install_taosx.sh" ]; then
|
||||||
cd ${script_dir}/taosx
|
cd ${script_dir}/taosx
|
||||||
chmod a+x install_taosx.sh
|
chmod a+x install_taosx.sh
|
||||||
bash install_taosx.sh
|
bash install_taosx.sh -e $serverFqdn
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -712,30 +719,7 @@ function clean_service_on_systemd() {
|
||||||
${csudo}systemctl stop tarbitratord &>/dev/null || echo &>/dev/null
|
${csudo}systemctl stop tarbitratord &>/dev/null || echo &>/dev/null
|
||||||
fi
|
fi
|
||||||
${csudo}systemctl disable tarbitratord &>/dev/null || echo &>/dev/null
|
${csudo}systemctl disable tarbitratord &>/dev/null || echo &>/dev/null
|
||||||
${csudo}rm -f ${tarbitratord_service_config}
|
${csudo}rm -f ${tarbitratord_service_config}
|
||||||
|
|
||||||
if [ "$verMode" == "cluster" ] && [ "$clientName" != "$clientName2" ]; then
|
|
||||||
x_service_config="${service_config_dir}/${xName2}.service"
|
|
||||||
if [ -e "$x_service_config" ]; then
|
|
||||||
if systemctl is-active --quiet ${xName2}; then
|
|
||||||
echo "${productName2} ${xName2} is running, stopping it..."
|
|
||||||
${csudo}systemctl stop ${xName2} &>/dev/null || echo &>/dev/null
|
|
||||||
fi
|
|
||||||
${csudo}systemctl disable ${xName2} &>/dev/null || echo &>/dev/null
|
|
||||||
${csudo}rm -f ${x_service_config}
|
|
||||||
fi
|
|
||||||
|
|
||||||
explorer_service_config="${service_config_dir}/${explorerName2}.service"
|
|
||||||
if [ -e "$explorer_service_config" ]; then
|
|
||||||
if systemctl is-active --quiet ${explorerName2}; then
|
|
||||||
echo "${productName2} ${explorerName2} is running, stopping it..."
|
|
||||||
${csudo}systemctl stop ${explorerName2} &>/dev/null || echo &>/dev/null
|
|
||||||
fi
|
|
||||||
${csudo}systemctl disable ${explorerName2} &>/dev/null || echo &>/dev/null
|
|
||||||
${csudo}rm -f ${explorer_service_config}
|
|
||||||
${csudo}rm -f /etc/${clientName2}/explorer.toml
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_service_on_systemd() {
|
function install_service_on_systemd() {
|
||||||
|
@ -756,15 +740,27 @@ function install_service_on_systemd() {
|
||||||
${csudo}systemctl daemon-reload
|
${csudo}systemctl daemon-reload
|
||||||
|
|
||||||
${csudo}systemctl enable ${serverName2}
|
${csudo}systemctl enable ${serverName2}
|
||||||
|
|
||||||
${csudo}systemctl daemon-reload
|
${csudo}systemctl daemon-reload
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_adapter_service() {
|
function install_adapter_service() {
|
||||||
if ((${service_mod} == 0)); then
|
if ((${service_mod} == 0)); then
|
||||||
[ -f ${script_dir}/cfg/${adapterName}.service ] &&
|
[ -f ${script_dir}/cfg/${adapterName2}.service ] &&
|
||||||
${csudo}cp ${script_dir}/cfg/${adapterName}.service \
|
${csudo}cp ${script_dir}/cfg/${adapterName2}.service \
|
||||||
${service_config_dir}/ || :
|
${service_config_dir}/ || :
|
||||||
|
|
||||||
|
${csudo}systemctl enable ${adapterName2}
|
||||||
|
${csudo}systemctl daemon-reload
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function install_keeper_service() {
|
||||||
|
if ((${service_mod} == 0)); then
|
||||||
|
[ -f ${script_dir}/cfg/${clientName2}keeper.service ] &&
|
||||||
|
${csudo}cp ${script_dir}/cfg/${clientName2}keeper.service \
|
||||||
|
${service_config_dir}/ || :
|
||||||
|
|
||||||
|
${csudo}systemctl enable ${clientName2}keeper
|
||||||
${csudo}systemctl daemon-reload
|
${csudo}systemctl daemon-reload
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -883,7 +879,7 @@ function updateProduct() {
|
||||||
tar -zxf ${tarName}
|
tar -zxf ${tarName}
|
||||||
install_jemalloc
|
install_jemalloc
|
||||||
|
|
||||||
echo -e "${GREEN}Start to update ${productName2}...${NC}"
|
echo "Start to update ${productName2}..."
|
||||||
# Stop the service if running
|
# Stop the service if running
|
||||||
if ps aux | grep -v grep | grep ${serverName2} &>/dev/null; then
|
if ps aux | grep -v grep | grep ${serverName2} &>/dev/null; then
|
||||||
if ((${service_mod} == 0)); then
|
if ((${service_mod} == 0)); then
|
||||||
|
@ -901,6 +897,7 @@ function updateProduct() {
|
||||||
install_log
|
install_log
|
||||||
install_header
|
install_header
|
||||||
install_lib
|
install_lib
|
||||||
|
install_config
|
||||||
|
|
||||||
if [ "$verMode" == "cluster" ]; then
|
if [ "$verMode" == "cluster" ]; then
|
||||||
install_connector
|
install_connector
|
||||||
|
@ -912,9 +909,9 @@ function updateProduct() {
|
||||||
if [ -z $1 ]; then
|
if [ -z $1 ]; then
|
||||||
install_bin
|
install_bin
|
||||||
install_service
|
install_service
|
||||||
install_adapter_service
|
install_adapter_service
|
||||||
install_config
|
|
||||||
install_adapter_config
|
install_adapter_config
|
||||||
|
install_keeper_service
|
||||||
|
|
||||||
openresty_work=false
|
openresty_work=false
|
||||||
|
|
||||||
|
@ -957,19 +954,18 @@ function updateProduct() {
|
||||||
# fi
|
# fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo -e "\033[44;32;1m${productName2} is updated successfully!${NC}"
|
echo "${productName2} is updated successfully!"
|
||||||
echo
|
echo
|
||||||
if [ "$verMode" == "cluster" ];then
|
if [ "$verMode" == "cluster" ];then
|
||||||
echo -e "\033[44;32;1mTo start all the components \t: sudo ./start-all.sh${NC}"
|
echo -e "\033[44;32;1mTo start all the components : sudo ./start-all.sh${NC}"
|
||||||
fi
|
fi
|
||||||
echo -e "\033[44;32;1mTo access ${productName2} \t\t: ${clientName2} -h $serverFqdn${NC}"
|
echo -e "\033[44;32;1mTo access ${productName2} : ${clientName2} -h $serverFqdn${NC}"
|
||||||
if [ "$verMode" == "cluster" ];then
|
if [ "$verMode" == "cluster" ];then
|
||||||
echo -e "\033[44;32;1mTo access the management system \t: http://$serverFqdn:6060${NC}"
|
echo -e "\033[44;32;1mTo access the management system : http://$serverFqdn:6060${NC}"
|
||||||
echo -e "\033[44;32;1mTo read the user manual \t: http://$serverFqdn:6060/docs${NC}"
|
echo -e "\033[44;32;1mTo read the user manual : http://$serverFqdn:6060/docs${NC}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
install_bin
|
install_bin
|
||||||
install_config
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo -e "\033[44;32;1m${productName2} client is updated successfully!${NC}"
|
echo -e "\033[44;32;1m${productName2} client is updated successfully!${NC}"
|
||||||
|
@ -987,7 +983,7 @@ function installProduct() {
|
||||||
fi
|
fi
|
||||||
tar -zxf ${tarName}
|
tar -zxf ${tarName}
|
||||||
|
|
||||||
echo -e "${GREEN}Start to install ${productName2}...${NC}"
|
echo "Start to install ${productName2}..."
|
||||||
|
|
||||||
install_main_path
|
install_main_path
|
||||||
|
|
||||||
|
@ -1001,6 +997,7 @@ function installProduct() {
|
||||||
install_jemalloc
|
install_jemalloc
|
||||||
#install_avro lib
|
#install_avro lib
|
||||||
#install_avro lib64
|
#install_avro lib64
|
||||||
|
install_config
|
||||||
|
|
||||||
if [ "$verMode" == "cluster" ]; then
|
if [ "$verMode" == "cluster" ]; then
|
||||||
install_connector
|
install_connector
|
||||||
|
@ -1014,10 +1011,10 @@ function installProduct() {
|
||||||
install_service
|
install_service
|
||||||
install_adapter_service
|
install_adapter_service
|
||||||
install_adapter_config
|
install_adapter_config
|
||||||
|
install_keeper_service
|
||||||
|
|
||||||
openresty_work=false
|
openresty_work=false
|
||||||
|
|
||||||
install_config
|
|
||||||
|
|
||||||
# Ask if to start the service
|
# Ask if to start the service
|
||||||
echo
|
echo
|
||||||
|
@ -1068,20 +1065,20 @@ function installProduct() {
|
||||||
# echo
|
# echo
|
||||||
# fi
|
# fi
|
||||||
echo
|
echo
|
||||||
echo -e "\033[44;32;1m${productName2} is installed successfully!${NC}"
|
echo "${productName2} is installed successfully!"
|
||||||
echo
|
echo
|
||||||
if [ "$verMode" == "cluster" ];then
|
if [ "$verMode" == "cluster" ];then
|
||||||
echo -e "\033[44;32;1mTo start all the components \t: sudo ./start-all.sh${NC}"
|
echo -e "\033[44;32;1mTo start all the components : sudo ./start-all.sh${NC}"
|
||||||
fi
|
fi
|
||||||
echo -e "\033[44;32;1mTo access ${productName2} \t\t: ${clientName2} -h $serverFqdn${NC}"
|
echo -e "\033[44;32;1mTo access ${productName2} : ${clientName2} -h $serverFqdn${NC}"
|
||||||
if [ "$verMode" == "cluster" ];then
|
if [ "$verMode" == "cluster" ];then
|
||||||
echo -e "\033[44;32;1mTo access the management system \t: http://$serverFqdn:6060${NC}"
|
echo -e "\033[44;32;1mTo access the management system : http://$serverFqdn:6060${NC}"
|
||||||
echo -e "\033[44;32;1mTo read the user manual \t: http://$serverFqdn:6060/docs${NC}"
|
echo -e "\033[44;32;1mTo read the user manual : http://$serverFqdn:6060/docs${NC}"
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
else # Only install client
|
else # Only install client
|
||||||
install_bin
|
install_bin
|
||||||
install_config
|
|
||||||
echo
|
echo
|
||||||
echo -e "\033[44;32;1m${productName2} client is installed successfully!${NC}"
|
echo -e "\033[44;32;1m${productName2} client is installed successfully!${NC}"
|
||||||
fi
|
fi
|
||||||
|
@ -1117,4 +1114,6 @@ elif [ "$verType" == "client" ]; then
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "please input correct verType"
|
echo "please input correct verType"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -374,6 +374,7 @@ if [ "$verMode" == "cluster" ]; then
|
||||||
cp -r ${top_dir}/../enterprise/src/plugins/taosx/release/taosx ${install_dir}
|
cp -r ${top_dir}/../enterprise/src/plugins/taosx/release/taosx ${install_dir}
|
||||||
cp ${top_dir}/../enterprise/packaging/install_taosx.sh ${install_dir}/taosx
|
cp ${top_dir}/../enterprise/packaging/install_taosx.sh ${install_dir}/taosx
|
||||||
cp ${top_dir}/../enterprise/src/plugins/taosx/packaging/uninstall.sh ${install_dir}/taosx
|
cp ${top_dir}/../enterprise/src/plugins/taosx/packaging/uninstall.sh ${install_dir}/taosx
|
||||||
|
sed -i 's/target=\"\"/target=\"taosx\"/g' ${install_dir}/taosx/uninstall.sh
|
||||||
else
|
else
|
||||||
echo "taox package not found"
|
echo "taox package not found"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
@ -113,8 +113,10 @@ function clean_bin() {
|
||||||
# Remove link
|
# Remove link
|
||||||
${csudo}rm -f ${bin_link_dir}/${clientName} || :
|
${csudo}rm -f ${bin_link_dir}/${clientName} || :
|
||||||
${csudo}rm -f ${bin_link_dir}/${serverName} || :
|
${csudo}rm -f ${bin_link_dir}/${serverName} || :
|
||||||
|
echo "${serverName} is removed successfully"
|
||||||
${csudo}rm -f ${bin_link_dir}/udfd || :
|
${csudo}rm -f ${bin_link_dir}/udfd || :
|
||||||
${csudo}rm -f ${bin_link_dir}/${adapterName2} || :
|
${csudo}rm -f ${bin_link_dir}/${adapterName2} || :
|
||||||
|
echo "${adapterName2} is removed successfully"
|
||||||
${csudo}rm -f ${bin_link_dir}/${benchmarkName2} || :
|
${csudo}rm -f ${bin_link_dir}/${benchmarkName2} || :
|
||||||
${csudo}rm -f ${bin_link_dir}/${demoName2} || :
|
${csudo}rm -f ${bin_link_dir}/${demoName2} || :
|
||||||
${csudo}rm -f ${bin_link_dir}/${dumpName2} || :
|
${csudo}rm -f ${bin_link_dir}/${dumpName2} || :
|
||||||
|
@ -175,7 +177,7 @@ function clean_log() {
|
||||||
function clean_service_on_systemd() {
|
function clean_service_on_systemd() {
|
||||||
taosd_service_config="${service_config_dir}/${taos_service_name}.service"
|
taosd_service_config="${service_config_dir}/${taos_service_name}.service"
|
||||||
if systemctl is-active --quiet ${taos_service_name}; then
|
if systemctl is-active --quiet ${taos_service_name}; then
|
||||||
echo "${productName2} ${serverName2} is running, stopping it..."
|
echo "${taos_service_name} is running, stopping it..."
|
||||||
${csudo}systemctl stop ${taos_service_name} &>/dev/null || echo &>/dev/null
|
${csudo}systemctl stop ${taos_service_name} &>/dev/null || echo &>/dev/null
|
||||||
fi
|
fi
|
||||||
${csudo}systemctl disable ${taos_service_name} &>/dev/null || echo &>/dev/null
|
${csudo}systemctl disable ${taos_service_name} &>/dev/null || echo &>/dev/null
|
||||||
|
@ -183,7 +185,7 @@ function clean_service_on_systemd() {
|
||||||
|
|
||||||
taosadapter_service_config="${service_config_dir}/${clientName2}adapter.service"
|
taosadapter_service_config="${service_config_dir}/${clientName2}adapter.service"
|
||||||
if systemctl is-active --quiet ${taosadapter_service_name}; then
|
if systemctl is-active --quiet ${taosadapter_service_name}; then
|
||||||
echo "${productName2} ${clientName2}Adapter is running, stopping it..."
|
echo "${clientName2}Adapter is running, stopping it..."
|
||||||
${csudo}systemctl stop ${taosadapter_service_name} &>/dev/null || echo &>/dev/null
|
${csudo}systemctl stop ${taosadapter_service_name} &>/dev/null || echo &>/dev/null
|
||||||
fi
|
fi
|
||||||
${csudo}systemctl disable ${taosadapter_service_name} &>/dev/null || echo &>/dev/null
|
${csudo}systemctl disable ${taosadapter_service_name} &>/dev/null || echo &>/dev/null
|
||||||
|
@ -196,33 +198,11 @@ function clean_service_on_systemd() {
|
||||||
fi
|
fi
|
||||||
${csudo}systemctl disable ${tarbitrator_service_name} &>/dev/null || echo &>/dev/null
|
${csudo}systemctl disable ${tarbitrator_service_name} &>/dev/null || echo &>/dev/null
|
||||||
|
|
||||||
if [ "$verMode" == "cluster" ] && [ "$clientName" != "$clientName2" ]; then
|
|
||||||
x_service_config="${service_config_dir}/${xName2}.service"
|
|
||||||
if [ -e "$x_service_config" ]; then
|
|
||||||
if systemctl is-active --quiet ${xName2}; then
|
|
||||||
echo "${productName2} ${xName2} is running, stopping it..."
|
|
||||||
${csudo}systemctl stop ${xName2} &>/dev/null || echo &>/dev/null
|
|
||||||
fi
|
|
||||||
${csudo}systemctl disable ${xName2} &>/dev/null || echo &>/dev/null
|
|
||||||
${csudo}rm -f ${x_service_config}
|
|
||||||
fi
|
|
||||||
|
|
||||||
explorer_service_config="${service_config_dir}/${explorerName2}.service"
|
|
||||||
if [ -e "$explorer_service_config" ]; then
|
|
||||||
if systemctl is-active --quiet ${explorerName2}; then
|
|
||||||
echo "${productName2} ${explorerName2} is running, stopping it..."
|
|
||||||
${csudo}systemctl stop ${explorerName2} &>/dev/null || echo &>/dev/null
|
|
||||||
fi
|
|
||||||
${csudo}systemctl disable ${explorerName2} &>/dev/null || echo &>/dev/null
|
|
||||||
${csudo}rm -f ${explorer_service_config}
|
|
||||||
${csudo}rm -f /etc/${clientName2}/explorer.toml
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function clean_service_on_sysvinit() {
|
function clean_service_on_sysvinit() {
|
||||||
if ps aux | grep -v grep | grep ${serverName} &>/dev/null; then
|
if ps aux | grep -v grep | grep ${serverName} &>/dev/null; then
|
||||||
echo "${productName2} ${serverName2} is running, stopping it..."
|
echo "${serverName2} is running, stopping it..."
|
||||||
${csudo}service ${serverName} stop || :
|
${csudo}service ${serverName} stop || :
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -287,10 +267,7 @@ function clean_service() {
|
||||||
function uninstall_taosx() {
|
function uninstall_taosx() {
|
||||||
if [ -f /usr/local/taosx/uninstall.sh ]; then
|
if [ -f /usr/local/taosx/uninstall.sh ]; then
|
||||||
cd /usr/local/taosx
|
cd /usr/local/taosx
|
||||||
bash uninstall.sh > /dev/null
|
bash uninstall.sh
|
||||||
|
|
||||||
echo -e "${GREEN}${xName2} is removed successfully!${NC}"
|
|
||||||
echo -e "${GREEN}${explorerName2} is removed successfully!${NC}"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,8 +309,75 @@ if [ "$osType" = "Darwin" ]; then
|
||||||
${csudo}rm -rf /Applications/TDengine.app
|
${csudo}rm -rf /Applications/TDengine.app
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "${GREEN}${productName2} is removed successfully!${NC}"
|
_kill_service_of() {
|
||||||
|
_service=$1
|
||||||
|
pid=$(ps -ef | grep "$_service" | grep -v "grep" | awk '{print $2}')
|
||||||
|
if [ -n "$pid" ]; then
|
||||||
|
${csudo}kill -9 $pid || :
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_clean_service_on_systemd_of() {
|
||||||
|
_service=$1
|
||||||
|
_service_config="${service_config_dir}/${_service}.service"
|
||||||
|
if systemctl is-active --quiet ${_service}; then
|
||||||
|
echo "taoskeeper is running, stopping it..."
|
||||||
|
${csudo}systemctl stop ${_service} &>/dev/null || echo &>/dev/null
|
||||||
|
fi
|
||||||
|
${csudo}systemctl disable ${_service} &>/dev/null || echo &>/dev/null
|
||||||
|
${csudo}rm -f ${_service_config}
|
||||||
|
}
|
||||||
|
_clean_service_on_sysvinit_of() {
|
||||||
|
_service=$1
|
||||||
|
if pidof ${_service} &>/dev/null; then
|
||||||
|
echo "${_service} is running, stopping it..."
|
||||||
|
${csudo}service ${_service} stop || :
|
||||||
|
fi
|
||||||
|
if ((${initd_mod} == 1)); then
|
||||||
|
if [ -e ${service_config_dir}/${_service} ]; then
|
||||||
|
${csudo}chkconfig --del ${_service} || :
|
||||||
|
fi
|
||||||
|
elif ((${initd_mod} == 2)); then
|
||||||
|
if [ -e ${service_config_dir}/${_service} ]; then
|
||||||
|
${csudo}insserv -r ${_service} || :
|
||||||
|
fi
|
||||||
|
elif ((${initd_mod} == 3)); then
|
||||||
|
if [ -e ${service_config_dir}/${_service} ]; then
|
||||||
|
${csudo}update-rc.d -f ${_service} remove || :
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
${csudo}rm -f ${service_config_dir}/${_service} || :
|
||||||
|
|
||||||
|
if $(which init &>/dev/null); then
|
||||||
|
${csudo}init q || :
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_clean_service_of() {
|
||||||
|
_service=$1
|
||||||
|
if ((${service_mod} == 0)); then
|
||||||
|
_clean_service_on_systemd_of $_service
|
||||||
|
elif ((${service_mod} == 1)); then
|
||||||
|
_clean_service_on_sysvinit_of $_service
|
||||||
|
else
|
||||||
|
_kill_service_of $_service
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
remove_taoskeeper() {
|
||||||
|
# remove taoskeeper bin
|
||||||
|
_clean_service_of taoskeeper
|
||||||
|
[ -e "${bin_link_dir}/taoskeeper" ] && ${csudo}rm -rf ${bin_link_dir}/taoskeeper
|
||||||
|
[ -e "${cfg_link_dir}/metrics.toml" ] || ${csudo}rm -rf ${cfg_link_dir}/metrics.toml
|
||||||
|
echo "taosKeeper is removed successfully!"
|
||||||
|
}
|
||||||
|
remove_taoskeeper
|
||||||
|
|
||||||
if [ "$verMode" == "cluster" ]; then
|
if [ "$verMode" == "cluster" ]; then
|
||||||
uninstall_taosx
|
uninstall_taosx
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "${productName2} is removed successfully!"
|
||||||
echo
|
echo
|
Loading…
Reference in New Issue