提交 5998060e 编写于 作者: H huili

[NONE]

上级 987249f4
...@@ -11,6 +11,8 @@ if pidof taosd &> /dev/null; then ...@@ -11,6 +11,8 @@ if pidof taosd &> /dev/null; then
${csudo} systemctl stop taosd || : ${csudo} systemctl stop taosd || :
elif $(which insserv &> /dev/null); then elif $(which insserv &> /dev/null); then
${csudo} service taosd stop || : ${csudo} service taosd stop || :
elif $(which update-rc.d &> /dev/null); then
${csudo} service taosd stop || :
else else
pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}') pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
${csudo} kill -9 ${pid} || : ${csudo} kill -9 ${pid} || :
......
...@@ -70,14 +70,6 @@ cp -r %{_compiledir}/../tests/examples/* %{buildroot}%{homepath}/exam ...@@ -70,14 +70,6 @@ cp -r %{_compiledir}/../tests/examples/* %{buildroot}%{homepath}/exam
#Scripts executed before installation #Scripts executed before installation
%pre %pre
function is_using_systemd() {
if pidof systemd &> /dev/null; then
return 0
else
return 1
fi
}
csudo="" csudo=""
if command -v sudo > /dev/null; then if command -v sudo > /dev/null; then
csudo="sudo" csudo="sudo"
...@@ -85,10 +77,15 @@ fi ...@@ -85,10 +77,15 @@ fi
# Stop the service if running # Stop the service if running
if pidof taosd &> /dev/null; then if pidof taosd &> /dev/null; then
if is_using_systemd; then if pidof systemd &> /dev/null; then
${csudo} systemctl stop taosd || : ${csudo} systemctl stop taosd || :
else elif $(which insserv &> /dev/null); then
${csudo} service taosd stop || : ${csudo} service taosd stop || :
elif $(which update-rc.d &> /dev/null); then
${csudo} service taosd stop || :
else
pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
${csudo} kill -9 ${pid} || :
fi fi
echo "Stop taosd service success!" echo "Stop taosd service success!"
sleep 1 sleep 1
......
...@@ -38,26 +38,26 @@ if command -v sudo > /dev/null; then ...@@ -38,26 +38,26 @@ if command -v sudo > /dev/null; then
csudo="sudo" csudo="sudo"
fi fi
initd_mod=0
service_mod=2 service_mod=2
if pidof systemd &> /dev/null; then if pidof systemd &> /dev/null; then
service_mod=0 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 elif $(which update-rc.d &> /dev/null); then
service_mod=1 service_mod=1
initd_mod=2
service_config_dir="/etc/init.d" service_config_dir="/etc/init.d"
else else
service_mod=2 service_mod=2
fi fi
function kill_taosd() { function kill_taosd() {
${csudo} pkill -f taosd || : # ${csudo} pkill -f taosd || :
} pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
${csudo} kill -9 ${pid} || :
function is_using_systemd() {
if pidof systemd &> /dev/null; then
return 0
else
return 1
fi
} }
function install_include() { function install_include() {
...@@ -103,12 +103,18 @@ function install_config() { ...@@ -103,12 +103,18 @@ function install_config() {
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
# ${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 || :
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册