[NONE]
This commit is contained in:
parent
987249f441
commit
5998060e8f
|
@ -11,6 +11,8 @@ if pidof taosd &> /dev/null; then
|
|||
${csudo} systemctl stop taosd || :
|
||||
elif $(which insserv &> /dev/null); then
|
||||
${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} || :
|
||||
|
|
|
@ -70,14 +70,6 @@ cp -r %{_compiledir}/../tests/examples/* %{buildroot}%{homepath}/exam
|
|||
|
||||
#Scripts executed before installation
|
||||
%pre
|
||||
function is_using_systemd() {
|
||||
if pidof systemd &> /dev/null; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
csudo=""
|
||||
if command -v sudo > /dev/null; then
|
||||
csudo="sudo"
|
||||
|
@ -85,10 +77,15 @@ fi
|
|||
|
||||
# Stop the service if running
|
||||
if pidof taosd &> /dev/null; then
|
||||
if is_using_systemd; then
|
||||
if pidof systemd &> /dev/null; then
|
||||
${csudo} systemctl stop taosd || :
|
||||
else
|
||||
elif $(which insserv &> /dev/null); then
|
||||
${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
|
||||
echo "Stop taosd service success!"
|
||||
sleep 1
|
||||
|
|
|
@ -38,26 +38,26 @@ if command -v sudo > /dev/null; then
|
|||
csudo="sudo"
|
||||
fi
|
||||
|
||||
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() {
|
||||
${csudo} pkill -f taosd || :
|
||||
}
|
||||
|
||||
function is_using_systemd() {
|
||||
if pidof systemd &> /dev/null; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
# ${csudo} pkill -f taosd || :
|
||||
pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
|
||||
${csudo} kill -9 ${pid} || :
|
||||
}
|
||||
|
||||
function install_include() {
|
||||
|
@ -103,12 +103,18 @@ function install_config() {
|
|||
|
||||
function clean_service_on_sysvinit() {
|
||||
restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
|
||||
#if pidof taosd &> /dev/null; then
|
||||
# ${csudo} service taosd stop || :
|
||||
#fi
|
||||
if pidof taosd &> /dev/null; then
|
||||
${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 || :
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue