github.com/polarismesh/polaris@v1.17.8/release/standalone/darwin/uninstall.sh (about)

     1  #!/bin/bash
     2  
     3  # Tencent is pleased to support the open source community by making Polaris available.
     4  #
     5  # Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
     6  #
     7  # Licensed under the BSD 3-Clause License (the "License");
     8  # you may not use this file except in compliance with the License.
     9  # You may obtain a copy of the License at
    10  #
    11  # https://opensource.org/licenses/BSD-3-Clause
    12  #
    13  # Unless required by applicable law or agreed to in writing, software distributed
    14  # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
    15  # CONDITIONS OF ANY KIND, either express or implied. See the License for the
    16  # specific language governing permissions and limitations under the License.
    17  
    18  function uninstallPolarisServer() {
    19    echo -e "uninstall polaris server ... "
    20    local polaris_server_dirname=$(find . -name "polaris-server-release*" -type d | awk 'NR==1{print}')
    21    if [ ! -e ${polaris_server_dirname} ]; then
    22      echo -e "${polaris_server_dirname} not exists, skip"
    23      return
    24    fi
    25    pushd ${polaris_server_dirname}
    26    echo -e "start to execute polaris-server uninstall script"
    27    /bin/bash ./tool/stop.sh
    28    popd
    29    echo -e "start to remove ${polaris_server_dirname}"
    30    rm -rf ${polaris_server_dirname}
    31    echo -e "uninstall polaris server success"
    32  }
    33  
    34  function uninstallPolarisConsole() {
    35    echo -e "uninstall polaris console ... "
    36    local polaris_console_dirname=$(find . -name "polaris-console-release*" -type d | awk 'NR==1{print}')
    37    if [ ! -e ${polaris_console_dirname} ]; then
    38      echo -e "${polaris_console_dirname} not exists, skip"
    39      return
    40    fi
    41    pushd ${polaris_console_dirname}
    42    echo -e "start to execute polaris-console uninstall script"
    43    /bin/bash ./tool/stop.sh
    44    popd
    45    echo -e "start to remove ${polaris_console_dirname}"
    46    rm -rf ${polaris_console_dirname}
    47    echo -e "uninstall polaris console success"
    48  }
    49  
    50  function uninstallPolarisLimiter() {
    51    echo -e "uninstall polaris limiter ... "
    52    local polaris_limiter_dirname=$(find . -name "polaris-limiter-release*" -type d | awk 'NR==1{print}')
    53    if [ ! -e ${polaris_limiter_dirname} ]; then
    54      echo -e "${polaris_limiter_dirname} not exists, skip"
    55      return
    56    fi
    57    pushd ${polaris_limiter_dirname}
    58    echo -e "start to execute polaris-limiter uninstall script"
    59    /bin/bash ./tool/stop.sh
    60    popd
    61    echo -e "start to remove ${polaris_limiter_dirname}"
    62    rm -rf ${polaris_limiter_dirname}
    63    echo -e "uninstall polaris limiter success"
    64  }
    65  
    66  function uninstallPrometheus() {
    67    echo -e "uninstall polaris-prometheus ... "
    68    local pid=$(ps -ef | grep polaris-prometheus | grep -v grep | awk '{print $2}')
    69    if [ "${pid}" != "" ]; then
    70      echo -e "start to kill polaris-prometheus process ${pid}"
    71      kill ${pid}
    72    fi
    73    local prometheus_dirname=$(find . -name "prometheus*" -type d | awk 'NR==1{print}')
    74    if [ -e ${prometheus_dirname} ]; then
    75      echo -e "start to remove ${prometheus_dirname}"
    76      rm -rf ${prometheus_dirname}
    77    fi
    78    echo -e "uninstall polaris-prometheus success"
    79  }
    80  
    81  function uninstallPushGateway() {
    82    echo -e "uninstall polaris-pushgateway ... "
    83    local pid=$(ps -ef | grep polaris-pushgateway | grep -v grep | awk '{print $2}')
    84    if [ "${pid}" != "" ]; then
    85      echo -e "start to kill polaris-pushgateway process ${pid}"
    86      kill ${pid}
    87    fi
    88    local pushgateway_dirname=$(find . -name "pushgateway*" -type d | awk 'NR==1{print}')
    89    if [ -e ${pushgateway_dirname} ]; then
    90      echo -e "start to remove ${pushgateway_dirname}"
    91      rm -rf ${pushgateway_dirname}
    92    fi
    93    echo -e "uninstall polaris-pushgateway success"
    94  }
    95  
    96  # 卸载 server
    97  uninstallPolarisServer
    98  # 卸载 console
    99  uninstallPolarisConsole
   100  # 卸载 polaris-limiter
   101  uninstallPolarisLimiter
   102  # 卸载 prometheus
   103  uninstallPrometheus
   104  # 安装PushGateWay
   105  uninstallPushGateway