提交 bc6b96c7 编写于 作者: H huili

[NONE]

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