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

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

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

10
${csudo}chmod -R 744 ${insmetaPath}  || :
H
[NONE]  
huili 已提交
11
#cd ${insmetaPath}
12
#${csudo}./preun.sh
H
[NONE]  
huili 已提交
13 14
if [ -f ${insmetaPath}/preun.sh ]; then
    cd ${insmetaPath}
15
    ${csudo}./preun.sh
H
[NONE]  
huili 已提交
16 17 18 19
else
    bin_link_dir="/usr/bin"
    lib_link_dir="/usr/lib"
    inc_link_dir="/usr/include"
20

H
[NONE]  
huili 已提交
21 22 23 24 25
    data_link_dir="/usr/local/taos/data"
    log_link_dir="/usr/local/taos/log"
    cfg_link_dir="/usr/local/taos/cfg"

    # Remove all links
26 27 28 29 30 31 32
    ${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     || :
    ${csudo}rm -f ${lib_link_dir}/libtaos.*  || :
33

34 35
    ${csudo}rm -f ${log_link_dir}            || :
    ${csudo}rm -f ${data_link_dir}           || :
36

H
[NONE]  
huili 已提交
37
    pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
L
lihui 已提交
38
    if [ -n "$pid" ]; then
39
        ${csudo}kill -9 $pid   || :
L
lihui 已提交
40
    fi
H
[NONE]  
huili 已提交
41 42
fi