github.com/polarismesh/polaris@v1.17.8/release/tool/start.bat (about)

     1  @echo off
     2  
     3  rem Tencent is pleased to support the open source community by making Polaris available.
     4  rem Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
     5  rem Licensed under the BSD 3-Clause License (the "License");
     6  rem you may not use this file except in compliance with the License.
     7  rem You may obtain a copy of the License at
     8  rem
     9  rem https://opensource.org/licenses/BSD-3-Clause
    10  rem
    11  rem Unless required by applicable law or agreed to in writing, software distributed
    12  rem under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
    13  rem CONDITIONS OF ANY KIND, either express or implied. See the License for the
    14  rem specific language governing permissions and limitations under the License.
    15  
    16  setlocal
    17  
    18  rem Guess POLARIS_HOME if not defined
    19  set "SERVER_NAME=polaris-server.exe"
    20  set "CURRENT_DIR=%cd%"
    21  if not "%POLARIS_HOME%" == "" goto gotHome
    22  set "POLARIS_HOME=%CURRENT_DIR%"
    23  if exist "%POLARIS_HOME%\%SERVER_NAME%" goto okHome
    24  cd ..
    25  set "POLARIS_HOME=%cd%"
    26  cd "%CURRENT_DIR%"
    27  :gotHome
    28  if exist "%POLARIS_HOME%\%SERVER_NAME%" goto okHome
    29  echo The POLARIS_HOME environment variable is not defined correctly
    30  echo This environment variable is needed to run this program
    31  goto end
    32  :okHome
    33  
    34  set "EXECUTABLE=%POLARIS_HOME%\%SERVER_NAME%"
    35  
    36  rem Check that target executable exists
    37  if exist "%EXECUTABLE%" goto okExec
    38  echo Cannot find "%EXECUTABLE%"
    39  echo This file is needed to run this program
    40  goto end
    41  :okExec
    42  
    43  echo "start %EXECUTABLE%"
    44  
    45  set/p SERVER_PROCESS=tasklist | findstr "%SERVER_NAME%"
    46  if not "%SERVER_PROCESS%" equ ""  (
    47     echo "%SERVER_PROCESS% started"
    48     goto end
    49  )
    50  
    51  pushd %POLARIS_HOME%
    52  start "" "%EXECUTABLE%" start
    53  popd
    54  goto end
    55  
    56  :end