prerm 1.1 KB
Newer Older
wafwerar's avatar
wafwerar 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
#!/bin/bash

insmetaPath="/usr/local/taos/script"

csudo=""
if command -v sudo > /dev/null; then
    csudo="sudo "
fi

${csudo}chmod -R 744 ${insmetaPath}  || :
#cd ${insmetaPath}
#${csudo}./preun.sh
if [ -f ${insmetaPath}/preun.sh ]; then
    cd ${insmetaPath}
    ${csudo}./preun.sh
else
    bin_link_dir="/usr/bin"
    lib_link_dir="/usr/lib"
    inc_link_dir="/usr/include"

    data_link_dir="/usr/local/taos/data"
    log_link_dir="/usr/local/taos/log"
    cfg_link_dir="/usr/local/taos/cfg"

    # Remove all links
    ${csudo}rm -f ${bin_link_dir}/taos       || :
    ${csudo}rm -f ${bin_link_dir}/taosd      || :
    ${csudo}rm -f ${bin_link_dir}/taosadapter       || :
    ${csudo}rm -f ${bin_link_dir}/taosdemo   || :
    ${csudo}rm -f ${cfg_link_dir}/*          || :
    ${csudo}rm -f ${inc_link_dir}/taos.h     || :
32
    ${csudo}rm -f ${inc_link_dir}/taosudf.h     || :
wafwerar's avatar
wafwerar 已提交
33 34 35 36 37 38 39 40 41 42 43
    ${csudo}rm -f ${lib_link_dir}/libtaos.*  || :

    ${csudo}rm -f ${log_link_dir}            || :
    ${csudo}rm -f ${data_link_dir}           || :

    pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
    if [ -n "$pid" ]; then
        ${csudo}kill -9 $pid   || :
    fi
fi