From ee2ec0e7eee3c26d77c5ddb5cf2de7f39b62e6c3 Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Fri, 19 Jul 2024 10:13:00 +0800 Subject: [PATCH] merge packaging script from main branch --- packaging/deb/DEBIAN/postinst | 1 + packaging/deb/DEBIAN/prerm | 1 + packaging/deb/makedeb.sh | 13 +- packaging/rpm/makerpm.sh | 4 +- packaging/rpm/tdengine.spec | 8 + packaging/tools/install.sh | 63 +++--- packaging/tools/makepkg.sh | 2 +- packaging/tools/post.sh | 127 ++++++----- packaging/tools/remove.sh | 359 ++++++++++--------------------- packaging/tools/remove_client.sh | 7 +- 10 files changed, 240 insertions(+), 345 deletions(-) diff --git a/packaging/deb/DEBIAN/postinst b/packaging/deb/DEBIAN/postinst index 2638f09625..8c2b8e78ce 100644 --- a/packaging/deb/DEBIAN/postinst +++ b/packaging/deb/DEBIAN/postinst @@ -8,6 +8,7 @@ if command -v sudo > /dev/null; then csudo="sudo " fi +${csudo}mkdir -p ${insmetaPath} ${csudo}chmod -R 744 ${insmetaPath} cd ${insmetaPath} ${csudo}./post.sh diff --git a/packaging/deb/DEBIAN/prerm b/packaging/deb/DEBIAN/prerm index a474dc4c80..2bbc6ff855 100644 --- a/packaging/deb/DEBIAN/prerm +++ b/packaging/deb/DEBIAN/prerm @@ -33,6 +33,7 @@ else ${csudo}rm -f ${bin_link_dir}/taosadapter || : ${csudo}rm -f ${bin_link_dir}/taosdemo || : ${csudo}rm -f ${bin_link_dir}/taoskeeper || : + ${csudo}rm -f ${bin_link_dir}/taos-explorer || : ${csudo}rm -f ${cfg_link_dir}/* || : ${csudo}rm -f ${inc_link_dir}/taos.h || : ${csudo}rm -f ${inc_link_dir}/taosdef.h || : diff --git a/packaging/deb/makedeb.sh b/packaging/deb/makedeb.sh index 337407f8d2..906a227ad5 100755 --- a/packaging/deb/makedeb.sh +++ b/packaging/deb/makedeb.sh @@ -76,11 +76,11 @@ if [ -f "${compile_dir}/test/cfg/taosadapter.service" ]; then cp ${compile_dir}/test/cfg/taosadapter.service ${pkg_dir}${install_home_path}/cfg || : fi -if [ -f "%{_compiledir}/../../../explorer/target/taos-explorer.service" ]; then - cp %{_compiledir}/../../../explorer/target/taos-explorer.service ${pkg_dir}${install_home_path}/cfg || : +if [ -f "${compile_dir}/../../../explorer/target/taos-explorer.service" ]; then + cp ${compile_dir}/../../../explorer/target/taos-explorer.service ${pkg_dir}${install_home_path}/cfg || : fi -if [ -f "%{_compiledir}/../../../explorer/server/example/explorer.toml" ]; then - cp %{_compiledir}/../../../explorer/server/example/explorer.toml ${pkg_dir}${install_home_path}/cfg || : +if [ -f "${compile_dir}/../../../explorer/server/example/explorer.toml" ]; then + cp ${compile_dir}/../../../explorer/server/example/explorer.toml ${pkg_dir}${install_home_path}/cfg || : fi cp ${taoskeeper_binary} ${pkg_dir}${install_home_path}/bin @@ -90,6 +90,11 @@ cp ${compile_dir}/../packaging/tools/preun.sh ${pkg_dir}${install_home_pat cp ${compile_dir}/../packaging/tools/startPre.sh ${pkg_dir}${install_home_path}/bin cp ${compile_dir}/../packaging/tools/set_core.sh ${pkg_dir}${install_home_path}/bin cp ${compile_dir}/../packaging/tools/taosd-dump-cfg.gdb ${pkg_dir}${install_home_path}/bin +cp ${top_dir}/../enterprise/packaging/start-all.sh ${pkg_dir}${install_home_path}/bin +cp ${top_dir}/../enterprise/packaging/stop-all.sh ${pkg_dir}${install_home_path}/bin +sed -i "s/versionType=\"enterprise\"/versionType=\"community\"/g" ${pkg_dir}${install_home_path}/bin/start-all.sh +sed -i "s/versionType=\"enterprise\"/versionType=\"community\"/g" ${pkg_dir}${install_home_path}/bin/stop-all.sh + cp ${compile_dir}/build/bin/taosd ${pkg_dir}${install_home_path}/bin cp ${compile_dir}/build/bin/udfd ${pkg_dir}${install_home_path}/bin diff --git a/packaging/rpm/makerpm.sh b/packaging/rpm/makerpm.sh index 9cf00364aa..f895193b6b 100755 --- a/packaging/rpm/makerpm.sh +++ b/packaging/rpm/makerpm.sh @@ -70,8 +70,8 @@ else fi cd ${top_dir} -echo "${top_dir}/../enterprise/packaging/build_taoskeeper.sh -r ${arch} -e taoskeeper" -taoskeeper_binary=`${top_dir}/../enterprise/packaging/build_taoskeeper.sh -r $arch -e taoskeeper` +echo "${top_dir}/../enterprise/packaging/build_taoskeeper.sh -r ${arch} -e taoskeeper -t ver-${tdengine_ver}" +taoskeeper_binary=`${top_dir}/../enterprise/packaging/build_taoskeeper.sh -r $arch -e taoskeeper -t ver-${tdengine_ver}` echo "taoskeeper_binary: ${taoskeeper_binary}" cd ${package_dir} diff --git a/packaging/rpm/tdengine.spec b/packaging/rpm/tdengine.spec index 6b324486b2..0a107a4108 100644 --- a/packaging/rpm/tdengine.spec +++ b/packaging/rpm/tdengine.spec @@ -56,6 +56,10 @@ mkdir -p %{buildroot}%{homepath}/include #mkdir -p %{buildroot}%{homepath}/init.d mkdir -p %{buildroot}%{homepath}/script +if [ -f %{_compiledir}/../packaging/cfg/taosd.service ]; then + cp %{_compiledir}/../packaging/cfg/taosd.service %{buildroot}%{homepath}/cfg +fi + cp %{_compiledir}/../packaging/cfg/taos.cfg %{buildroot}%{homepath}/cfg if [ -f %{_compiledir}/test/cfg/taosadapter.toml ]; then cp %{_compiledir}/test/cfg/taosadapter.toml %{buildroot}%{homepath}/cfg @@ -91,6 +95,10 @@ cp %{_compiledir}/build/bin/taosd %{buildroot}%{homepath}/bin cp %{_compiledir}/build/bin/udfd %{buildroot}%{homepath}/bin cp %{_compiledir}/build/bin/taosBenchmark %{buildroot}%{homepath}/bin cp %{_compiledir}/build/bin/taosdump %{buildroot}%{homepath}/bin +cp %{_compiledir}/../../enterprise/packaging/start-all.sh %{buildroot}%{homepath}/bin +cp %{_compiledir}/../../enterprise/packaging/stop-all.sh %{buildroot}%{homepath}/bin +sed -i "s/versionType=\"enterprise\"/versionType=\"community\"/g" %{buildroot}%{homepath}/bin/start-all.sh +sed -i "s/versionType=\"enterprise\"/versionType=\"community\"/g" %{buildroot}%{homepath}/bin/stop-all.sh if [ -f %{_compiledir}/../../../explorer/target/release/taos-explorer ]; then cp %{_compiledir}/../../../explorer/target/release/taos-explorer %{buildroot}%{homepath}/bin diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index 03e0a0b5f5..cc3868d2f0 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -156,7 +156,7 @@ done #echo "verType=${verType} interactiveFqdn=${interactiveFqdn}" -tools=(${clientName} ${benchmarkName} ${dumpName} ${demoName} remove.sh udfd set_core.sh TDinsight.sh start_pre.sh) +tools=(${clientName} ${benchmarkName} ${dumpName} ${demoName} remove.sh udfd set_core.sh TDinsight.sh start_pre.sh start-all.sh stop-all.sh) if [ "${verMode}" == "cluster" ]; then services=(${serverName} ${adapterName} ${xname} ${explorerName} ${keeperName}) elif [ "${verMode}" == "edge" ]; then @@ -221,6 +221,8 @@ function install_bin() { ${csudo}cp -r ${script_dir}/bin/remove.sh ${install_main_dir}/bin else ${csudo}cp -r ${script_dir}/bin/* ${install_main_dir}/bin + ${csudo}cp ${script_dir}/start-all.sh ${install_main_dir}/bin + ${csudo}cp ${script_dir}/stop-all.sh ${install_main_dir}/bin fi if [[ "${verMode}" == "cluster" && "${verType}" != "client" ]]; then @@ -576,7 +578,9 @@ function install_taosd_config() { ${csudo}sed -i -r "s/#*\s*(fqdn\s*).*/\1$serverFqdn/" ${script_dir}/cfg/${configFile} ${csudo}echo "monitor 1" >>${script_dir}/cfg/${configFile} ${csudo}echo "monitorFQDN ${serverFqdn}" >>${script_dir}/cfg/${configFile} - ${csudo}echo "audit 1" >>${script_dir}/cfg/${configFile} + if [ "$verMode" == "cluster" ]; then + ${csudo}echo "audit 1" >>${script_dir}/cfg/${configFile} + fi if [ -f "${configDir}/${configFile}" ]; then ${csudo}cp ${fileName} ${configDir}/${configFile}.new @@ -594,6 +598,7 @@ function install_config() { [ ! -z $1 ] && return 0 || : # only install client if ((${update_flag} == 1)); then + install_taosd_config return 0 fi @@ -651,9 +656,7 @@ function install_data() { function install_connector() { if [ -d "${script_dir}/connector/" ]; then - ${csudo}cp -rf ${script_dir}/connector/ ${install_main_dir}/ || echo "failed to copy connector" - ${csudo}cp ${script_dir}/start-all.sh ${install_main_dir}/ || echo "failed to copy start-all.sh" - ${csudo}cp ${script_dir}/stop-all.sh ${install_main_dir}/ || echo "failed to copy stop-all.sh" + ${csudo}cp -rf ${script_dir}/connector/ ${install_main_dir}/ || echo "failed to copy connector" ${csudo}cp ${script_dir}/README.md ${install_main_dir}/ || echo "failed to copy README.md" fi } @@ -910,39 +913,36 @@ function updateProduct() { echo echo -e "${GREEN_DARK}To configure ${productName} ${NC}\t\t: edit ${configDir}/${configFile}" [ -f ${configDir}/${adapterName}.toml ] && [ -f ${installDir}/bin/${adapterName} ] && - echo -e "${GREEN_DARK}To configure ${adapterName} ${NC}\t: edit ${configDir}/${adapterName}.toml" - if [ "$verMode" == "cluster" ]; then - echo -e "${GREEN_DARK}To configure ${explorerName} ${NC}\t: edit ${configDir}/explorer.toml" - fi + echo -e "${GREEN_DARK}To configure ${adapterName} ${NC}\t: edit ${configDir}/${adapterName}.toml" + echo -e "${GREEN_DARK}To configure ${explorerName} ${NC}\t: edit ${configDir}/explorer.toml" if ((${service_mod} == 0)); then - echo -e "${GREEN_DARK}To start ${productName} ${NC}\t\t: ${csudo}systemctl start ${serverName}${NC}" + echo -e "${GREEN_DARK}To start ${productName} server ${NC}\t: ${csudo}systemctl start ${serverName}${NC}" [ -f ${service_config_dir}/${clientName}adapter.service ] && [ -f ${installDir}/bin/${clientName}adapter ] && echo -e "${GREEN_DARK}To start ${clientName}Adapter ${NC}\t\t: ${csudo}systemctl start ${clientName}adapter ${NC}" elif ((${service_mod} == 1)); then - echo -e "${GREEN_DARK}To start ${productName} ${NC}\t\t: ${csudo}service ${serverName} start${NC}" + echo -e "${GREEN_DARK}To start ${productName} server ${NC}\t: ${csudo}service ${serverName} start${NC}" [ -f ${service_config_dir}/${clientName}adapter.service ] && [ -f ${installDir}/bin/${clientName}adapter ] && echo -e "${GREEN_DARK}To start ${clientName}Adapter ${NC}\t\t: ${csudo}service ${clientName}adapter start${NC}" else - echo -e "${GREEN_DARK}To start ${productName} ${NC}\t\t: ./${serverName}${NC}" + echo -e "${GREEN_DARK}To start ${productName} server ${NC}\t: ./${serverName}${NC}" [ -f ${installDir}/bin/${clientName}adapter ] && echo -e "${GREEN_DARK}To start ${clientName}Adapter ${NC}\t\t: ${clientName}adapter ${NC}" fi - echo -e "${GREEN_DARK}To enable ${clientName}keeper ${NC}\t\t: sudo systemctl enable ${clientName}keeper ${NC}" + echo -e "${GREEN_DARK}To start ${clientName}keeper ${NC}\t\t: sudo systemctl start ${clientName}keeper ${NC}" if [ "$verMode" == "cluster" ]; then - echo -e "${GREEN_DARK}To start ${clientName}x ${NC}\t\t\t: sudo systemctl start ${clientName}x ${NC}" - echo -e "${GREEN_DARK}To start ${clientName}-explorer ${NC}\t\t: sudo systemctl start ${clientName}-explorer ${NC}" + echo -e "${GREEN_DARK}To start ${clientName}x ${NC}\t\t\t: sudo systemctl start ${clientName}x ${NC}" fi + echo -e "${GREEN_DARK}To start ${clientName}-explorer ${NC}\t\t: sudo systemctl start ${clientName}-explorer ${NC}" echo echo "${productName} is updated successfully!" echo + + echo -e "\033[44;32;1mTo start all the components : sudo start-all.sh${NC}" + echo -e "\033[44;32;1mTo access ${productName} Commnd Line Interface : ${clientName} -h $serverFqdn${NC}" + echo -e "\033[44;32;1mTo access ${productName} Graphic User Interface : http://$serverFqdn:6060${NC}" if [ "$verMode" == "cluster" ]; then - echo -e "\033[44;32;1mTo start all the components : ./start-all.sh${NC}" - fi - echo -e "\033[44;32;1mTo access ${productName} : ${clientName} -h $serverFqdn${NC}" - if [ "$verMode" == "cluster" ]; then - echo -e "\033[44;32;1mTo access the management system : http://$serverFqdn:6060${NC}" echo -e "\033[44;32;1mTo read the user manual : http://$serverFqdn:6060/docs${NC}" fi else @@ -1007,39 +1007,36 @@ function installProduct() { echo -e "${GREEN_DARK}To configure ${productName} ${NC}\t\t: edit ${configDir}/${configFile}" [ -f ${configDir}/${clientName}adapter.toml ] && [ -f ${installDir}/bin/${clientName}adapter ] && echo -e "${GREEN_DARK}To configure ${clientName}Adapter ${NC}\t: edit ${configDir}/${clientName}adapter.toml" - if [ "$verMode" == "cluster" ]; then - echo -e "${GREEN_DARK}To configure ${clientName}-explorer ${NC}\t: edit ${configDir}/explorer.toml" - fi + echo -e "${GREEN_DARK}To configure ${clientName}-explorer ${NC}\t: edit ${configDir}/explorer.toml" if ((${service_mod} == 0)); then - echo -e "${GREEN_DARK}To start ${productName} ${NC}\t\t: ${csudo}systemctl start ${serverName}${NC}" + echo -e "${GREEN_DARK}To start ${productName} server ${NC}\t: ${csudo}systemctl start ${serverName}${NC}" [ -f ${service_config_dir}/${clientName}adapter.service ] && [ -f ${installDir}/bin/${clientName}adapter ] && echo -e "${GREEN_DARK}To start ${clientName}Adapter ${NC}\t\t: ${csudo}systemctl start ${clientName}adapter ${NC}" elif ((${service_mod} == 1)); then - echo -e "${GREEN_DARK}To start ${productName} ${NC}\t\t: ${csudo}service ${serverName} start${NC}" + echo -e "${GREEN_DARK}To start ${productName} server ${NC}\t: ${csudo}service ${serverName} start${NC}" [ -f ${service_config_dir}/${clientName}adapter.service ] && [ -f ${installDir}/bin/${clientName}adapter ] && echo -e "${GREEN_DARK}To start ${clientName}Adapter ${NC}\t\t: ${csudo}service ${clientName}adapter start${NC}" else - echo -e "${GREEN_DARK}To start ${productName} ${NC}\t\t: ${serverName}${NC}" + echo -e "${GREEN_DARK}To start ${productName} server ${NC}\t: ${serverName}${NC}" [ -f ${installDir}/bin/${clientName}adapter ] && echo -e "${GREEN_DARK}To start ${clientName}Adapter ${NC}\t\t: ${clientName}adapter ${NC}" fi - echo -e "${GREEN_DARK}To enable ${clientName}keeper ${NC}\t\t: sudo systemctl enable ${clientName}keeper ${NC}" + echo -e "${GREEN_DARK}To start ${clientName}keeper ${NC}\t\t: sudo systemctl start ${clientName}keeper ${NC}" if [ "$verMode" == "cluster" ]; then echo -e "${GREEN_DARK}To start ${clientName}x ${NC}\t\t\t: sudo systemctl start ${clientName}x ${NC}" - echo -e "${GREEN_DARK}To start ${clientName}-explorer ${NC}\t\t: sudo systemctl start ${clientName}-explorer ${NC}" fi + echo -e "${GREEN_DARK}To start ${clientName}-explorer ${NC}\t\t: sudo systemctl start ${clientName}-explorer ${NC}" echo echo "${productName} is installed successfully!" echo + + echo -e "\033[44;32;1mTo start all the components : sudo start-all.sh${NC}" + echo -e "\033[44;32;1mTo access ${productName} Commnd Line Interface : ${clientName} -h $serverFqdn${NC}" + echo -e "\033[44;32;1mTo access ${productName} Graphic User Interface : http://$serverFqdn:6060${NC}" if [ "$verMode" == "cluster" ]; then - echo -e "\033[44;32;1mTo start all the components : sudo ./start-all.sh${NC}" - fi - echo -e "\033[44;32;1mTo access ${productName} : ${clientName} -h $serverFqdn${NC}" - if [ "$verMode" == "cluster" ]; then - echo -e "\033[44;32;1mTo access the management system : http://$serverFqdn:6060${NC}" echo -e "\033[44;32;1mTo read the user manual : http://$serverFqdn:6060/docs-en${NC}" fi echo diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh index 5733c35ebe..9e1cc73238 100755 --- a/packaging/tools/makepkg.sh +++ b/packaging/tools/makepkg.sh @@ -232,7 +232,7 @@ fi if [ "$verMode" == "cluster" ]; then sed 's/verMode=edge/verMode=cluster/g' ${install_dir}/bin/remove.sh >>remove_temp.sh - sed -i "s/PREFIX=\"taos\"/PREFIX=\"${serverName2}\"/g" remove_temp.sh + sed -i "s/PREFIX=\"taos\"/PREFIX=\"${clientName2}\"/g" remove_temp.sh sed -i "s/productName=\"TDengine\"/productName=\"${productName2}\"/g" remove_temp.sh mv remove_temp.sh ${install_dir}/bin/remove.sh fi diff --git a/packaging/tools/post.sh b/packaging/tools/post.sh index ceaebfdc7c..6b4c96e8c4 100755 --- a/packaging/tools/post.sh +++ b/packaging/tools/post.sh @@ -104,6 +104,8 @@ fi function log_print(){ now=$(date +"%D %T") + ${csudo}mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir} + ${csudo} touch ${install_log_path} echo "$now $1" >> ${install_log_path} } @@ -235,11 +237,14 @@ function install_bin() { ${csudo}rm -f ${bin_link_dir}/taosadapter || : ${csudo}rm -f ${bin_link_dir}/taosBenchmark || : ${csudo}rm -f ${bin_link_dir}/taoskeeper || : + ${csudo}rm -f ${bin_link_dir}/taos-explorer || : ${csudo}rm -f ${bin_link_dir}/taosdemo || : ${csudo}rm -f ${bin_link_dir}/taosdump || : ${csudo}rm -f ${bin_link_dir}/rmtaos || : ${csudo}rm -f ${bin_link_dir}/set_core || : ${csudo}rm -f ${bin_link_dir}/*explorer || : + ${csudo}rm -f ${bin_link_dir}/start-all.sh || : + ${csudo}rm -f ${bin_link_dir}/stop-all.sh || : ${csudo}chmod 0555 ${bin_dir}/* @@ -275,8 +280,14 @@ function install_bin() { if [ -x ${bin_dir}/taoskeeper ]; then ${csudo}ln -sf ${bin_dir}/taoskeeper ${bin_link_dir}/taoskeeper 2>>${install_log_path} || return 1 fi - if [ -x ${bin_dir}/*explorer ]; then - ${csudo}ln -s ${bin_dir}/*explorer ${bin_link_dir}/*explorer 2>>${install_log_path} || return 1 + if [ -x ${bin_dir}/taos-explorer ]; then + ${csudo}ln -s ${bin_dir}/taos-explorer ${bin_link_dir}/taos-explorer 2>>${install_log_path} || return 1 + fi + if [ -x ${bin_dir}/start-all.sh ]; then + ${csudo}ln -s ${bin_dir}/start-all.sh ${bin_link_dir}/start-all.sh 2>>${install_log_path} || return 1 + fi + if [ -x ${bin_dir}/stop-all.sh ]; then + ${csudo}ln -s ${bin_dir}/stop-all.sh ${bin_link_dir}/stop-all.sh 2>>${install_log_path} || return 1 fi log_print "install bin success" } @@ -474,6 +485,22 @@ function install_taoskeeper_config() { ${csudo}ln -s ${cfg_install_dir}/taoskeeper.toml ${cfg_dir} } +function install_taos-explorer_config() { + if [ ! -f "${cfg_install_dir}/explorer.toml" ]; then + [ ! -d ${cfg_install_dir} ] && + ${csudo}${csudo}mkdir -p ${cfg_install_dir} + [ -f ${cfg_dir}/explorer.toml ] && ${csudo}cp ${cfg_dir}/explorer.toml ${cfg_install_dir} + [ -f ${cfg_install_dir}/explorer.toml ] && + ${csudo}chmod 644 ${cfg_install_dir}/explorer.toml + fi + + [ -f ${cfg_dir}/explorer.toml ] && + ${csudo}mv ${cfg_dir}/explorer.toml ${cfg_dir}/explorer.toml.new + + [ -f ${cfg_install_dir}/explorer.toml ] && + ${csudo}ln -s ${cfg_install_dir}/explorer.toml ${cfg_dir} +} + function install_config() { log_print "start install config from ${cfg_dir} to ${cfg_install_dir}" if [ ! -f "${cfg_install_dir}/taos.cfg" ]; then @@ -609,30 +636,12 @@ function clean_service_on_systemd() { function install_service_on_systemd() { clean_service_on_systemd + + [ -f ${script_dir}/../cfg/taosd.service ] &&\ + ${csudo}cp ${script_dir}/../cfg/taosd.service \ + ${service_config_dir}/ || : - taosd_service_config="${service_config_dir}/taosd.service" - - ${csudo}bash -c "echo '[Unit]' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'Description=TDengine server service' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'After=network-online.target' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'Wants=network-online.target' >> ${taosd_service_config}" - ${csudo}bash -c "echo >> ${taosd_service_config}" - ${csudo}bash -c "echo '[Service]' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'Type=simple' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'ExecStart=/usr/bin/taosd' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'ExecStartPre=/usr/local/taos/bin/startPre.sh' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'LimitCORE=infinity' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'StandardOutput=null' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'Restart=always' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'StartLimitBurst=3' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${taosd_service_config}" - ${csudo}bash -c "echo >> ${taosd_service_config}" - ${csudo}bash -c "echo '[Install]' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${taosd_service_config}" + ${csudo}systemctl daemon-reload ${csudo}systemctl enable taosd } @@ -652,6 +661,11 @@ function install_service_on_launchctl() { ${csudo}cp ${install_main_dir}/service/com.taosdata.taoskeeper.plist /Library/LaunchDaemons/com.taosdata.taoskeeper.plist || : ${csudo}launchctl load -w /Library/LaunchDaemons/com.taosdata.taoskeeper.plist || : fi + if [ -f ${install_main_dir}/service/com.taosdata.taos-explorer.plist ]; then + ${csudo}launchctl unload -w /Library/LaunchDaemons/com.taosdata.taos-explorer.plist > /dev/null 2>&1 || : + ${csudo}cp ${install_main_dir}/service/com.taosdata.taos-explorer.plist /Library/LaunchDaemons/com.taosdata.taos-explorer.plist || : + ${csudo}launchctl load -w /Library/LaunchDaemons/com.taosdata.taos-explorer.plist || : + fi } function install_taosadapter_service() { @@ -672,6 +686,15 @@ function install_taoskeeper_service() { fi } +function install_taos-explorer_service() { + if ((${service_mod}==0)); then + [ -f ${script_dir}/../cfg/taos-explorer.service ] &&\ + ${csudo}cp ${script_dir}/../cfg/taos-explorer.service \ + ${service_config_dir}/ || : + ${csudo}systemctl daemon-reload + fi +} + function install_service() { log_print "start install service" if [ "$osType" != "Darwin" ]; then @@ -748,8 +771,10 @@ function install_TDengine() { install_config install_taosadapter_config install_taoskeeper_config + install_taos-explorer_config install_taosadapter_service install_taoskeeper_service + install_taos-explorer_service install_service install_app @@ -757,40 +782,38 @@ function install_TDengine() { #echo #echo -e "\033[44;32;1mTDengine is installed successfully!${NC}" echo - echo -e "${GREEN_DARK}To configure TDengine ${NC}: edit /etc/taos/taos.cfg" + echo -e "${GREEN_DARK}To configure TDengine ${NC}\t: edit /etc/taos/taos.cfg" + echo -e "${GREEN_DARK}To configure taosAdapter ${NC}\t: edit /etc/taos/taosadapter.toml" + echo -e "${GREEN_DARK}To configure taos-explorer ${NC}\t: edit /etc/taos/explorer.toml" if ((${service_mod}==0)); then - echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo}systemctl start taosd${NC}" + echo -e "${GREEN_DARK}To start TDengine server ${NC}\t: ${csudo}systemctl start taosd${NC}" + echo -e "${GREEN_DARK}To start taosAdapter ${NC}\t: ${csudo}systemctl start taosadapter${NC}" + echo -e "${GREEN_DARK}To start taoskeeper ${NC}\t: ${csudo}systemctl start taoskeeper${NC}" + echo -e "${GREEN_DARK}To start taos-explorer ${NC}\t: ${csudo}systemctl start taos-explorer${NC}" elif ((${service_mod}==1)); then - echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo}update-rc.d taosd default ${RED} for the first time${NC}" + echo -e "${GREEN_DARK}To start TDengine server ${NC}\t: ${csudo}update-rc.d taosd default ${RED} for the first time${NC}" echo -e " : ${csudo}service taosd start ${RED} after${NC}" + echo -e "${GREEN_DARK}To start taosAdapter ${NC}\t: ${csudo}update-rc.d taosadapter default ${RED} for the first time${NC}" + echo -e " : ${csudo}service taosd taosadapter ${RED} after${NC}" + echo -e "${GREEN_DARK}To start taoskeeper ${NC}\t: ${csudo}update-rc.d taoskeeper default ${RED} for the first time${NC}" + echo -e " : ${csudo}service taosd taoskeeper ${RED} after${NC}" + echo -e "${GREEN_DARK}To start taos-explorer ${NC}\t: ${csudo}update-rc.d taos-explorer default ${RED} for the first time${NC}" + echo -e " : ${csudo}service taosd taos-explorer ${RED} after${NC}" else - echo -e "${GREEN_DARK}To start TDengine ${NC}: ./taosd${NC}" - fi - - - - if [ ! -z "$firstEp" ]; then - tmpFqdn=${firstEp%%:*} - substr=":" - if [[ $firstEp =~ $substr ]];then - tmpPort=${firstEp#*:} - else - tmpPort="" - fi - if [[ "$tmpPort" != "" ]];then - echo -e "${GREEN_DARK}To access TDengine ${NC}: taos -h $tmpFqdn -P $tmpPort${GREEN_DARK} to login into cluster, then${NC}" - else - echo -e "${GREEN_DARK}To access TDengine ${NC}: taos -h $tmpFqdn${GREEN_DARK} to login into cluster, then${NC}" - fi - echo -e "${GREEN_DARK}execute ${NC}: create dnode 'newDnodeFQDN:port'; ${GREEN_DARK}to add this new node${NC}" - echo - elif [ ! -z "$serverFqdn" ]; then - echo -e "${GREEN_DARK}To access TDengine ${NC}: taos -h $serverFqdn${GREEN_DARK} to login into TDengine server${NC}" - echo + echo -e "${GREEN_DARK}To start TDengine server ${NC}\t: ./taosd${NC}" + echo -e "${GREEN_DARK}To start taosAdapter ${NC}\t: ./taosadapter${NC}" + echo -e "${GREEN_DARK}To start taoskeeper ${NC}\t: ./taoskeeper${NC}" + echo -e "${GREEN_DARK}To start taos-explorer ${NC}\t: ./taos-explorer${NC}" fi + log_print "install TDengine successfully!" echo - echo -e "\033[44;32;1mTDengine is installed successfully!${NC}" + echo "TDengine is installed successfully!" + echo + echo -e "\033[44;32;1mTo start all the components : sudo start-all.sh${NC}" + echo -e "\033[44;32;1mTo access ${productName} Commnd Line Interface : taos -h $serverFqdn${NC}" + echo -e "\033[44;32;1mTo access ${productName} Graphic User Interface : http://$serverFqdn:6060${NC}" + } diff --git a/packaging/tools/remove.sh b/packaging/tools/remove.sh index 36298a291e..378949591f 100755 --- a/packaging/tools/remove.sh +++ b/packaging/tools/remove.sh @@ -31,25 +31,22 @@ else lib64_link_dir="/usr/local/lib" inc_link_dir="/usr/local/include" fi -serverName="taosd" -clientName="taos" -uninstallScript="rmtaos" + +PREFIX="taos" +serverName="${PREFIX}d" +clientName="${PREFIX}" +uninstallScript="rm${PREFIX}" +adapterName="${PREFIX}adapter" +demoName="${PREFIX}demo" +benchmarkName="${PREFIX}Benchmark" +dumpName="${PREFIX}dump" +keeperName="${PREFIX}keeper" +xName="${PREFIX}x" +explorerName="${PREFIX}-explorer" +tarbitratorName="tarbitratord" productName="TDengine" -serverName2="taosd" -clientName2="taos" -productName2="TDengine" - -adapterName2="${clientName2}adapter" -demoName2="${clientName2}demo" -benchmarkName2="${clientName2}Benchmark" -dumpName2="${clientName2}dump" -keeperName2="${clientName2}keeper" -xName2="${clientName2}x" -explorerName2="${clientName2}-explorer" -uninstallScript2="rm${clientName2}" - -installDir="/usr/local/${clientName2}" +installDir="/usr/local/${PREFIX}" #install main path install_main_dir=${installDir} @@ -57,15 +54,11 @@ data_link_dir=${installDir}/data log_link_dir=${installDir}/log cfg_link_dir=${installDir}/cfg local_bin_link_dir="/usr/local/bin" - - service_config_dir="/etc/systemd/system" -taos_service_name=${serverName2} -taosadapter_service_name="${clientName2}adapter" -tarbitrator_service_name="tarbitratord" - -config_dir="/etc/${clientName2}" +config_dir="/etc/${PREFIX}" +services=(${PREFIX}"d" ${PREFIX}"adapter" ${PREFIX}"x" ${PREFIX}"-explorer" ${PREFIX}"keeper") +tools=(${PREFIX} ${PREFIX}"Benchmark" ${PREFIX}"dump" ${PREFIX}"demo" udfd set_core.sh TDinsight.sh $uninstallScript start-all.sh stop-all.sh) csudo="" if command -v sudo >/dev/null; then @@ -92,215 +85,26 @@ else service_mod=2 fi -function kill_taosadapter() { - pid=$(ps -ef | grep "${adapterName2}" | grep -v "grep" | awk '{print $2}') - if [ -n "$pid" ]; then - ${csudo}kill -9 $pid || : - fi -} - -function kill_taosd() { - pid=$(ps -ef | grep ${serverName2} | grep -v "grep" | awk '{print $2}') - if [ -n "$pid" ]; then - ${csudo}kill -9 $pid || : - fi -} - -function kill_tarbitrator() { - pid=$(ps -ef | grep "tarbitrator" | grep -v "grep" | awk '{print $2}') - if [ -n "$pid" ]; then - ${csudo}kill -9 $pid || : - fi -} - -function clean_bin() { - # Remove link - ${csudo}rm -f ${bin_link_dir}/${clientName} || : - ${csudo}rm -f ${bin_link_dir}/${serverName} || : - echo "${serverName} is removed successfully" - ${csudo}rm -f ${bin_link_dir}/udfd || : - ${csudo}rm -f ${bin_link_dir}/${adapterName2} || : - echo "${adapterName2} is removed successfully" - ${csudo}rm -f ${bin_link_dir}/${benchmarkName2} || : - ${csudo}rm -f ${bin_link_dir}/${demoName2} || : - ${csudo}rm -f ${bin_link_dir}/${dumpName2} || : - ${csudo}rm -f ${bin_link_dir}/${uninstallScript} || : - ${csudo}rm -f ${bin_link_dir}/tarbitrator || : - ${csudo}rm -f ${bin_link_dir}/set_core || : - ${csudo}rm -f ${bin_link_dir}/TDinsight.sh || : - ${csudo}rm -f ${bin_link_dir}/${keeperName2} || : - - - if [ "$verMode" == "cluster" ] && [ "$clientName" != "$clientName2" ]; then - ${csudo}rm -f ${bin_link_dir}/${xName2} || : - ${csudo}rm -f ${bin_link_dir}/${explorerName2} || : - ${csudo}rm -f ${bin_link_dir}/${clientName2} || : - ${csudo}rm -f ${bin_link_dir}/${benchmarkName2} || : - ${csudo}rm -f ${bin_link_dir}/${dumpName2} || : - ${csudo}rm -f ${bin_link_dir}/${uninstallScript2} || : - fi -} - -function clean_local_bin() { - ${csudo}rm -f ${local_bin_link_dir}/${benchmarkName2} || : - ${csudo}rm -f ${local_bin_link_dir}/${demoName2} || : -} - -function clean_lib() { - # Remove link - ${csudo}rm -f ${lib_link_dir}/libtaos.* || : - [ -f ${lib_link_dir}/libtaosws.* ] && ${csudo}rm -f ${lib_link_dir}/libtaosws.* || : - - ${csudo}rm -f ${lib64_link_dir}/libtaos.* || : - [ -f ${lib64_link_dir}/libtaosws.* ] && ${csudo}rm -f ${lib64_link_dir}/libtaosws.* || : - #${csudo}rm -rf ${v15_java_app_dir} || : - -} - -function clean_header() { - # Remove link - ${csudo}rm -f ${inc_link_dir}/taos.h || : - ${csudo}rm -f ${inc_link_dir}/taosdef.h || : - ${csudo}rm -f ${inc_link_dir}/taoserror.h || : - ${csudo}rm -f ${inc_link_dir}/tdef.h || : - ${csudo}rm -f ${inc_link_dir}/taosudf.h || : - - [ -f ${inc_link_dir}/taosws.h ] && ${csudo}rm -f ${inc_link_dir}/taosws.h || : -} - -function clean_config() { - # Remove link - ${csudo}rm -f ${cfg_link_dir}/* || : -} - -function clean_log() { - # Remove link - ${csudo}rm -rf ${log_link_dir} || : -} - -function clean_service_on_systemd() { - taosd_service_config="${service_config_dir}/${taos_service_name}.service" - if systemctl is-active --quiet ${taos_service_name}; then - echo "${taos_service_name} is running, stopping it..." - ${csudo}systemctl stop ${taos_service_name} &>/dev/null || echo &>/dev/null - fi - ${csudo}systemctl disable ${taos_service_name} &>/dev/null || echo &>/dev/null - ${csudo}rm -f ${taosd_service_config} - - taosadapter_service_config="${service_config_dir}/${clientName2}adapter.service" - if systemctl is-active --quiet ${taosadapter_service_name}; then - echo "${clientName2}Adapter is running, stopping it..." - ${csudo}systemctl stop ${taosadapter_service_name} &>/dev/null || echo &>/dev/null - fi - ${csudo}systemctl disable ${taosadapter_service_name} &>/dev/null || echo &>/dev/null - [ -f ${taosadapter_service_config} ] && ${csudo}rm -f ${taosadapter_service_config} - - tarbitratord_service_config="${service_config_dir}/${tarbitrator_service_name}.service" - if systemctl is-active --quiet ${tarbitrator_service_name}; then - echo "${productName2} tarbitrator is running, stopping it..." - ${csudo}systemctl stop ${tarbitrator_service_name} &>/dev/null || echo &>/dev/null - fi - ${csudo}systemctl disable ${tarbitrator_service_name} &>/dev/null || echo &>/dev/null - -} - -function clean_service_on_sysvinit() { - if ps aux | grep -v grep | grep ${serverName} &>/dev/null; then - echo "${serverName2} is running, stopping it..." - ${csudo}service ${serverName} stop || : - fi - - if ps aux | grep -v grep | grep tarbitrator &>/dev/null; then - echo "${productName2} tarbitrator is running, stopping it..." - ${csudo}service tarbitratord stop || : - fi - - if ((${initd_mod} == 1)); then - if [ -e ${service_config_dir}/${serverName} ]; then - ${csudo}chkconfig --del ${serverName} || : - fi - if [ -e ${service_config_dir}/tarbitratord ]; then - ${csudo}chkconfig --del tarbitratord || : - fi - elif ((${initd_mod} == 2)); then - if [ -e ${service_config_dir}/${serverName} ]; then - ${csudo}insserv -r ${serverName} || : - fi - if [ -e ${service_config_dir}/tarbitratord ]; then - ${csudo}insserv -r tarbitratord || : - fi - elif ((${initd_mod} == 3)); then - if [ -e ${service_config_dir}/${serverName} ]; then - ${csudo}update-rc.d -f ${serverName} remove || : - fi - if [ -e ${service_config_dir}/tarbitratord ]; then - ${csudo}update-rc.d -f tarbitratord remove || : - fi - fi - - ${csudo}rm -f ${service_config_dir}/${serverName} || : - ${csudo}rm -f ${service_config_dir}/tarbitratord || : - - if $(which init &>/dev/null); then - ${csudo}init q || : - fi -} - -function clean_service_on_launchctl() { - ${csudouser}launchctl unload -w /Library/LaunchDaemons/com.taosdata.taosd.plist > /dev/null 2>&1 || : - ${csudo}rm /Library/LaunchDaemons/com.taosdata.taosd.plist > /dev/null 2>&1 || : - ${csudouser}launchctl unload -w /Library/LaunchDaemons/com.taosdata.${clientName2}adapter.plist > /dev/null 2>&1 || : - ${csudo}rm /Library/LaunchDaemons/com.taosdata.${clientName2}adapter.plist > /dev/null 2>&1 || : -} - -function clean_service() { - if ((${service_mod} == 0)); then - clean_service_on_systemd - elif ((${service_mod} == 1)); then - clean_service_on_sysvinit - else - if [ "$osType" = "Darwin" ]; then - clean_service_on_launchctl - fi - kill_taosadapter - kill_taosd - kill_tarbitrator - fi -} - -function remove_data_and_config() { - data_dir=`grep dataDir /etc/taos/taos.cfg | grep -v '#' | tail -n 1 | awk {'print $2'}` - if [ X"$data_dir" == X"" ]; then - data_dir="/var/lib/taos" - fi - log_dir=`grep logDir /etc/taos/taos.cfg | grep -v '#' | tail -n 1 | awk {'print $2'}` - if [ X"$log_dir" == X"" ]; then - log_dir="/var/log/taos" - fi - [ -d "${config_dir}" ] && ${csudo}rm -rf ${config_dir}/* - [ -d "${data_dir}" ] && ${csudo}rm -rf ${data_dir}/* - [ -d "${log_dir}" ] && ${csudo}rm -rf ${log_dir}/* -} - -_kill_service_of() { +kill_service_of() { _service=$1 - pid=$(ps -ef | grep "$_service" | grep -v "grep" | awk '{print $2}') + pid=$(ps -ef | grep $_service | grep -v grep | grep -v $uninstallScript | awk '{print $2}') if [ -n "$pid" ]; then ${csudo}kill -9 $pid || : fi } -_clean_service_on_systemd_of() { +clean_service_on_systemd_of() { _service=$1 _service_config="${service_config_dir}/${_service}.service" if systemctl is-active --quiet ${_service}; then - echo "taoskeeper is running, stopping it..." + echo "${_service} is running, stopping it..." ${csudo}systemctl stop ${_service} &>/dev/null || echo &>/dev/null fi ${csudo}systemctl disable ${_service} &>/dev/null || echo &>/dev/null ${csudo}rm -f ${_service_config} } -_clean_service_on_sysvinit_of() { + +clean_service_on_sysvinit_of() { _service=$1 if pidof ${_service} &>/dev/null; then echo "${_service} is running, stopping it..." @@ -327,45 +131,99 @@ _clean_service_on_sysvinit_of() { fi } -_clean_service_of() { +clean_service_of() { _service=$1 if ((${service_mod} == 0)); then - _clean_service_on_systemd_of $_service + clean_service_on_systemd_of $_service elif ((${service_mod} == 1)); then - _clean_service_on_sysvinit_of $_service + clean_service_on_sysvinit_of $_service else - _kill_service_of $_service + kill_service_of $_service fi } -remove_taoskeeper() { - # remove taoskeeper bin - _clean_service_of taoskeeper - [ -e "${bin_link_dir}/taoskeeper" ] && ${csudo}rm -rf ${bin_link_dir}/taoskeeper - [ -e "${installDir}/taoskeeper" ] && ${csudo}rm -rf ${installDir}/taoskeeper - [ -e "${cfg_link_dir}/metrics.toml" ] || ${csudo}rm -rf ${cfg_link_dir}/metrics.toml - echo "taosKeeper is removed successfully!" -} - -function uninstall_taosx() { - if [ -f ${installDir}/uninstall.sh ]; then - cd ${installDir} - bash uninstall.sh +remove_service_of() { + _service=$1 + clean_service_of ${_service} + if [[ -e "${bin_link_dir}/${_service}" || -e "${installDir}/bin/${_service}" || -e "${local_bin_link_dir}/${_service}" ]]; then + ${csudo}rm -rf ${bin_link_dir}/${_service} + ${csudo}rm -rf ${installDir}/bin/${_service} + ${csudo}rm -rf ${local_bin_link_dir}/${_service} + echo "${_service} is removed successfully!" fi } -if [ "$verMode" == "cluster" ]; then - uninstall_taosx -fi +remove_tools_of() { + _tool=$1 + kill_service_of ${_tool} + [ -e "${bin_link_dir}/${_tool}" ] && ${csudo}rm -rf ${bin_link_dir}/${_tool} || : + [ -e "${installDir}/bin/${_tool}" ] && ${csudo}rm -rf ${installDir}/bin/${_tool} || : + [ -e "${local_bin_link_dir}/${_tool}" ] && ${csudo}rm -rf ${local_bin_link_dir}/${_tool} || : +} -remove_taoskeeper -# Stop service and disable booting start. -clean_service -# Remove binary file and links -clean_bin -# Remove links of local bin -clean_local_bin -# Remove header file. +remove_bin() { + for _service in "${services[@]}"; do + remove_service_of ${_service} + done + + for _tool in "${tools[@]}"; do + remove_tools_of ${_tool} + done +} + +function clean_lib() { + # Remove link + ${csudo}rm -f ${lib_link_dir}/libtaos.* || : + [ -f ${lib_link_dir}/libtaosws.* ] && ${csudo}rm -f ${lib_link_dir}/libtaosws.* || : + + ${csudo}rm -f ${lib64_link_dir}/libtaos.* || : + [ -f ${lib64_link_dir}/libtaosws.* ] && ${csudo}rm -f ${lib64_link_dir}/libtaosws.* || : + #${csudo}rm -rf ${v15_java_app_dir} || : +} + +function clean_header() { + # Remove link + ${csudo}rm -f ${inc_link_dir}/taos.h || : + ${csudo}rm -f ${inc_link_dir}/taosdef.h || : + ${csudo}rm -f ${inc_link_dir}/taoserror.h || : + ${csudo}rm -f ${inc_link_dir}/tdef.h || : + ${csudo}rm -f ${inc_link_dir}/taosudf.h || : + + [ -f ${inc_link_dir}/taosws.h ] && ${csudo}rm -f ${inc_link_dir}/taosws.h || : +} + +function clean_config() { + # Remove link + ${csudo}rm -f ${cfg_link_dir}/* || : +} + +function clean_log() { + # Remove link + ${csudo}rm -rf ${log_link_dir} || : +} + +function clean_service_on_launchctl() { + ${csudouser}launchctl unload -w /Library/LaunchDaemons/com.taosdata.taosd.plist > /dev/null 2>&1 || : + ${csudo}rm /Library/LaunchDaemons/com.taosdata.taosd.plist > /dev/null 2>&1 || : + ${csudouser}launchctl unload -w /Library/LaunchDaemons/com.taosdata.${clientName2}adapter.plist > /dev/null 2>&1 || : + ${csudo}rm /Library/LaunchDaemons/com.taosdata.${clientName2}adapter.plist > /dev/null 2>&1 || : +} + +function remove_data_and_config() { + data_dir=`grep dataDir /etc/taos/taos.cfg | grep -v '#' | tail -n 1 | awk {'print $2'}` + if [ X"$data_dir" == X"" ]; then + data_dir="/var/lib/${PREFIX}" + fi + log_dir=`grep logDir /etc/taos/taos.cfg | grep -v '#' | tail -n 1 | awk {'print $2'}` + if [ X"$log_dir" == X"" ]; then + log_dir="/var/log/${PREFIX}" + fi + [ -d "${config_dir}" ] && ${csudo}rm -rf ${config_dir} + [ -d "${data_dir}" ] && ${csudo}rm -rf ${data_dir} + [ -d "${log_dir}" ] && ${csudo}rm -rf ${log_dir} +} + +remove_bin clean_header # Remove lib file clean_lib @@ -375,8 +233,7 @@ clean_log clean_config # Remove data link directory ${csudo}rm -rf ${data_link_dir} || : - -${csudo}rm -rf ${install_main_dir} +${csudo}rm -rf ${install_main_dir} || : if [[ -e /etc/os-release ]]; then osinfo=$(awk -F= '/^NAME/{print $2}' /etc/os-release) else @@ -394,6 +251,7 @@ elif echo $osinfo | grep -qwi "centos"; then ${csudo}rpm -e --noscripts tdengine >/dev/null 2>&1 || : fi if [ "$osType" = "Darwin" ]; then + clean_service_on_launchctl ${csudo}rm -rf /Applications/TDengine.app fi @@ -411,6 +269,7 @@ if [ X$answer == X"y" ] || [ X$answer == X"Y" ]; then fi fi +command -v systemctl >/dev/null 2>&1 && ${csudo}systemctl daemon-reload >/dev/null 2>&1 || true echo -echo "${productName2} is removed successfully!" +echo "${productName} is removed successfully!" echo diff --git a/packaging/tools/remove_client.sh b/packaging/tools/remove_client.sh index 695307254d..d183c10a31 100755 --- a/packaging/tools/remove_client.sh +++ b/packaging/tools/remove_client.sh @@ -38,9 +38,10 @@ if command -v sudo > /dev/null; then fi function kill_client() { - if [ -n "$(ps aux | grep -v grep | grep ${clientName})" ]; then - ${csudo}kill -9 $pid || : - fi + pid=$(ps -ef | grep ${clientName2} | grep -v grep | grep -v $uninstallScript2 | awk '{print $2}') + if [ -n "$pid" ]; then + ${csudo}kill -9 $pid || : + fi } function clean_bin() {