github.com/polarismesh/polaris@v1.17.8/release/standalone/windows/stop-windows.ps1 (about)

     1  # Tencent is pleased to support the open source community by making Polaris available.
     2  #
     3  # Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
     4  #
     5  # Licensed under the BSD 3-Clause License (the "License");
     6  # you may not use this file except in compliance with the License.
     7  # You may obtain a copy of the License at
     8  #
     9  # https://opensource.org/licenses/BSD-3-Clause
    10  #
    11  # Unless required by applicable law or agreed to in writing, software distributed
    12  # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
    13  # CONDITIONS OF ANY KIND, either express or implied. See the License for the
    14  # specific language governing permissions and limitations under the License.
    15  
    16  $ErrorActionPreference = "Stop"
    17  
    18  function stopPolarisServer {
    19      Write-Output "stop polaris server ... "
    20      Get-Process | ForEach-Object($_.name) {
    21          if($_.name -eq "polaris-server") {
    22              $process_pid = $_.Id
    23              Write-Output "start to kill polaris-server process $process_pid"
    24              Stop-Process -Id $process_pid
    25              Start-Sleep -Seconds 2
    26          }
    27      }
    28      Write-Output "stop polaris server success"
    29  }
    30  
    31  function stopPolarisConsole {
    32      Write-Output "stop polaris-console ... "
    33      Get-Process | ForEach-Object($_.name) {
    34          if($_.name -eq "polaris-console") {
    35              $process_pid = $_.Id
    36              Write-Output "start to kill polaris-console process $process_pid"
    37              Stop-Process -Id $process_pid
    38              Start-Sleep -Seconds 2
    39          }
    40      }
    41      Write-Output "stop polaris console success"
    42  }
    43  
    44  function stopPolarisLimiter {
    45      Write-Output "stop polaris-limiter ... "
    46      Get-Process | ForEach-Object($_.name) {
    47          if($_.name -eq "polaris-limiter") {
    48              $process_pid = $_.Id
    49              Write-Output "start to kill polaris-limiter process $process_pid"
    50              Stop-Process -Id $process_pid
    51              Start-Sleep -Seconds 2
    52          }
    53      }
    54      Write-Output "stop polaris limiter success"
    55  }
    56  
    57  function stopPrometheus {
    58      Write-Output "stop prometheus ... "
    59      Get-Process | ForEach-Object($_.name) {
    60          if($_.name -eq "prometheus") {
    61              $process_pid = $_.Id
    62              Write-Output "start to kill prometheus process $process_pid"
    63              Stop-Process -Id $process_pid
    64              Start-Sleep -Seconds 2
    65          }
    66      }
    67      Write-Output "stop prometheus success"
    68  }
    69  
    70  function stopPushGateway {
    71      Write-Output "stop pushgateway ... "
    72      Get-Process | ForEach-Object($_.name) {
    73          if($_.name -eq "pushgateway") {
    74              $process_pid = $_.Id
    75              Write-Output "start to kill pushgateway process $process_pid"
    76              Stop-Process -Id $process_pid
    77              Start-Sleep -Seconds 2
    78          }
    79      }
    80      Write-Output "stop pushgateway success"
    81  }
    82  
    83  # 停止 server
    84  stopPolarisServer
    85  # 停止 console
    86  stopPolarisConsole
    87  # 停止 limiter
    88  stopPolarisLimiter
    89  # 停止 prometheus
    90  stopPrometheus
    91  # 停止 pushgateway
    92  stopPushGateway