#!/bin/bash csudo="" if command -v sudo > /dev/null; then csudo="sudo" fi # Stop the service if running if pidof taosd &> /dev/null; then if pidof systemd &> /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} || : fi echo "Stop taosd service success!" sleep 1 fi # if taos.cfg already softlink, remove it cfg_install_dir="/etc/taos" install_main_dir="/usr/local/taos" if [ -f ${cfg_install_dir}/taos.cfg ]; then ${csudo} rm -f ${install_main_dir}/cfg/taos.cfg || : fi # there can not libtaos.so*, otherwise ln -s error ${csudo} rm -f ${install_main_dir}/driver/libtaos* || :