prerm 1.1 KB
Newer Older
H
hzcheng 已提交
1 2 3 4
#!/bin/bash

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

P
plum-lihui 已提交
5 6 7 8
csudo=""
if command -v sudo > /dev/null; then
    csudo="sudo"
fi
H
hzcheng 已提交
9

H
[NONE]  
huili 已提交
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
${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}/taosdemo   || :
    ${csudo} rm -f ${bin_link_dir}/taosdump   || :
    ${csudo} rm -f ${cfg_link_dir}/*          || :
    ${csudo} rm -f ${inc_link_dir}/taos.h     || :
    ${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}')
L
lihui 已提交
38 39 40
    if [ -n "$pid" ]; then
        ${csudo} kill -9 $pid   || :
    fi
H
[NONE]  
huili 已提交
41 42
fi