提交 bc6b96c7 编写于 作者: H huili

[NONE]

上级 5998060e
......@@ -23,18 +23,27 @@ if command -v sudo > /dev/null; then
csudo="sudo"
fi
function is_using_systemd() {
if pidof systemd &> /dev/null; then
return 0
else
return 1
fi
}
if ! is_using_systemd; then
initd_mod=0
service_mod=2
if pidof systemd &> /dev/null; then
service_mod=0
elif $(which insserv &> /dev/null); then
service_mod=1
initd_mod=1
service_config_dir="/etc/init.d"
elif $(which update-rc.d &> /dev/null); then
service_mod=1
initd_mod=2
service_config_dir="/etc/init.d"
else
service_mod=2
fi
function kill_taosd() {
pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
${csudo} kill -9 ${pid} || :
}
function clean_bin() {
# Remove link
${csudo} rm -f ${bin_link_dir}/taos || :
......@@ -78,23 +87,29 @@ function clean_service_on_systemd() {
function clean_service_on_sysvinit() {
restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
if pidof taosd &> /dev/null; then
echo "TDengine taosd is running, stopping it..."
${csudo} service taosd stop || :
fi
${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
${csudo} rm -f ${service_config_dir}/taosd || :
${csudo} update-rc.d -f taosd remove || :
if ((${initd_mod}==1)); then
${csudo} grep -q -F "taos" /etc/inittab && ${csudo} insserv -r taosd || :
elif ((${initd_mod}==2)); then
${csudo} grep -q -F "taos" /etc/inittab && ${csudo} update-rc.d -f taosd remove || :
fi
# ${csudo} update-rc.d -f taosd remove || :
${csudo} init q || :
}
function clean_service() {
if is_using_systemd; then
if ((${service_mod}==0)); then
clean_service_on_systemd
else
elif ((${service_mod}==1)); then
clean_service_on_sysvinit
else
# must manual start taosd
kill_taosd
fi
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册