Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
loser646
TDengine
提交
dbe8dd40
T
TDengine
项目概览
loser646
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
dbe8dd40
编写于
6月 18, 2021
作者:
L
liuyq-617
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-4690]<test>script:check install package
上级
155b4a66
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
245 addition
and
0 deletion
+245
-0
packaging/check_package.sh
packaging/check_package.sh
+245
-0
未找到文件。
packaging/check_package.sh
0 → 100755
浏览文件 @
dbe8dd40
#!/bin/bash
#
# This file is used to install database on linux systems. The operating system
# is required to use systemd to manage services at boot
set
-e
#set -x
verMode
=
edge
pagMode
=
full
iplist
=
""
serverFqdn
=
""
# -----------------------Variables definition---------------------
script_dir
=
"../release"
# Dynamic directory
data_dir
=
"/var/lib/taos"
log_dir
=
"/var/log/taos"
data_link_dir
=
"/usr/local/taos/data"
log_link_dir
=
"/usr/local/taos/log"
cfg_install_dir
=
"/etc/taos"
bin_link_dir
=
"/usr/bin"
lib_link_dir
=
"/usr/lib"
lib64_link_dir
=
"/usr/lib64"
inc_link_dir
=
"/usr/include"
#install main path
install_main_dir
=
"/usr/local/taos"
# old bin dir
sbin_dir
=
"/usr/local/taos/bin"
temp_version
=
""
fin_result
=
""
service_config_dir
=
"/etc/systemd/system"
nginx_port
=
6060
nginx_dir
=
"/usr/local/nginxd"
# Color setting
RED
=
'\033[0;31m'
GREEN
=
'\033[1;32m'
GREEN_DARK
=
'\033[0;32m'
GREEN_UNDERLINE
=
'\033[4;32m'
NC
=
'\033[0m'
csudo
=
""
if
command
-v
sudo
>
/dev/null
;
then
csudo
=
"sudo"
fi
# ============================= get input parameters =================================================
# install.sh -v [server | client] -e [yes | no] -i [systemd | service | ...]
# set parameters by default value
interactiveFqdn
=
yes
# [yes | no]
verType
=
server
# [server | client]
initType
=
systemd
# [systemd | service | ...]
while
getopts
"hv:d:"
arg
do
case
$arg
in
d
)
#echo "interactiveFqdn=$OPTARG"
script_dir
=
$(
echo
$OPTARG
)
;;
h
)
echo
"Usage:
`
basename
$0
`
-d scripy_path"
exit
0
;;
?
)
#unknow option
echo
"unkonw argument"
exit
1
;;
esac
done
#echo "verType=${verType} interactiveFqdn=${interactiveFqdn}"
function
kill_process
()
{
pid
=
$(
ps
-ef
|
grep
"
$1
"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
if
[
-n
"
$pid
"
]
;
then
${
csudo
}
kill
-9
$pid
||
:
fi
}
function
check_file
()
{
#check file whether exists
if
[
!
-e
$1
/
$2
]
;
then
echo
-e
"
$1
/
$2
\0
33[31mnot exists
\0
33[0m!quit"
fin_result
=
$fin_result
"
\0
33[31m
$temp_version
\0
33[0m test failed!
\n
"
echo
-e
$fin_result
exit
8
fi
}
function
get_package_name
()
{
var
=
$1
if
[[
$1
=
~
'aarch'
]]
;
then
echo
${
var
::-21
}
else
echo
${
var
::-17
}
fi
}
function
check_link
()
{
#check Link whether exists or broken
if
[
-L
$1
]
;
then
if
[
!
-e
$1
]
;
then
echo
-e
"
$1
\0
33[31Broken link
\0
33[0m"
fin_result
=
$fin_result
"
\0
33[31m
$temp_version
\0
33[0m test failed!
\n
"
echo
-e
$fin_result
exit
8
fi
else
echo
-e
"
$1
\0
33[31mnot exists
\0
33[0m!quit"
fin_result
=
$fin_result
"
\0
33[31m
$temp_version
\0
33[0m test failed!
\n
"
echo
-e
$fin_result
exit
8
fi
}
function
check_main_path
()
{
#check install main dir and all sub dir
main_dir
=(
""
"cfg"
"bin"
"connector"
"driver"
"examples"
"include"
"init.d"
)
for
i
in
${
main_dir
[@]
}
;
do
check_file
${
install_main_dir
}
$i
done
if
[
"
$verMode
"
==
"cluster"
]
;
then
nginx_main_dir
=(
"admin"
"conf"
"html"
"sbin"
"logs"
)
for
i
in
${
nginx_main_dir
[@]
}
;
do
check_file
${
nginx_dir
}
$i
done
fi
echo
-e
"Check main path:
\0
33[32mOK
\0
33[0m!"
}
function
check_bin_path
()
{
# check install bin dir and all sub dir
bin_dir
=(
"taos"
"taosd"
"taosdemo"
"taosdump"
"remove.sh"
"tarbitrator"
"set_core.sh"
)
for
i
in
${
bin_dir
[@]
}
;
do
check_file
${
sbin_dir
}
$i
done
lbin_dir
=(
"taos"
"taosd"
"taosdemo"
"taosdump"
"rmtaos"
"tarbitrator"
"set_core"
)
for
i
in
${
lbin_dir
[@]
}
;
do
check_link
${
bin_link_dir
}
/
$i
done
if
[
"
$verMode
"
==
"cluster"
]
;
then
check_file
${
nginx_dir
}
/sbin nginx
fi
echo
-e
"Check bin path:
\0
33[32mOK
\0
33[0m!"
}
function
check_lib_path
()
{
# check all links
check_link
${
lib_link_dir
}
/libtaos.so
check_link
${
lib_link_dir
}
/libtaos.so.1
if
[[
-d
${
lib64_link_dir
}
]]
;
then
check_link
${
lib64_link_dir
}
/libtaos.so
check_link
${
lib64_link_dir
}
/libtaos.so.1
fi
echo
-e
"Check lib path:
\0
33[32mOK
\0
33[0m!"
}
function
check_header_path
()
{
# check all header
header_dir
=(
"taos.h"
"taoserror.h"
)
for
i
in
${
header_dir
[@]
}
;
do
check_link
${
inc_link_dir
}
/
$i
done
echo
-e
"Check bin path:
\0
33[32mOK
\0
33[0m!"
}
function
check_config_dir
()
{
# check all config
check_file
${
cfg_install_dir
}
taos.cfg
check_file
${
install_main_dir
}
/cfg taos.cfg.org
echo
-e
"Check conf path:
\0
33[32mOK
\0
33[0m!"
}
function
check_log_path
()
{
# check log path
check_file
${
log_dir
}
echo
-e
"Check log path:
\0
33[32mOK
\0
33[0m!"
}
function
check_data_path
()
{
# check data path
check_file
${
data_dir
}
echo
-e
"Check data path:
\0
33[32mOK
\0
33[0m!"
}
function
install_TDengine
()
{
cd
${
script_dir
}
tar
zxf
$1
temp_version
=
$(
get_package_name
$1
)
cd
$(
get_package_name
$1
)
echo
-e
"
\0
33[32muninstall TDengine && install TDengine...
\0
33[0m"
rmtaos
>
/dev/null 2>&1
||
echo
'taosd not installed'
&&
echo
-e
'\n\n'
|./install.sh
>
/dev/null 2>&1
echo
-e
"
\0
33[32mTDengine has been installed!
\0
33[0m"
echo
-e
"
\0
33[32mTDengine is starting...
\0
33[0m"
kill_process taos
&&
systemctl start taosd
&&
sleep
10
}
function
test_TDengine
()
{
check_main_path
check_bin_path
check_lib_path
check_header_path
check_config_dir
check_log_path
check_data_path
result
=
`
taos
-s
'create database test ;create table test.tt(ts timestamp ,i int);insert into test.tt values(now,11);select * from test.tt'
2>&1
||
:
`
if
[[
$result
=
~
"Unable to establish"
]]
;
then
echo
-e
"
\0
33[31mTDengine connect failed
\0
33[0m"
fin_result
=
$fin_result
"
\0
33[31m
$temp_version
\0
33[0m test failed!
\n
"
echo
-e
$fin_result
exit
8
fi
echo
-e
"Check TDengine connect:
\0
33[32mOK
\0
33[0m!"
fin_result
=
$fin_result
"
\0
33[32m
$temp_version
\0
33[0m test OK!
\n
"
}
# ## ==============================Main program starts from here============================
TD_package_name
=
`
ls
${
script_dir
}
/
*
server
*
gz |awk
-F
'/'
'{print $NF}'
`
temp
=
`
pwd
`
for
i
in
$TD_package_name
;
do
if
[[
$i
=
~
'enterprise'
]]
;
then
verMode
=
"cluster"
else
verMode
=
""
fi
cd
$temp
install_TDengine
$i
test_TDengine
done
echo
"============================================================"
echo
-e
$fin_result
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录