shutdown.cmd 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. @echo off
  2. :: Copyright 1999-2018 Alibaba Group Holding Ltd.
  3. :: Licensed under the Apache License, Version 2.0 (the "License");
  4. :: you may not use this file except in compliance with the License.
  5. :: You may obtain a copy of the License at
  6. ::
  7. :: http://www.apache.org/licenses/LICENSE-2.0
  8. ::
  9. :: Unless required by applicable law or agreed to in writing, software
  10. :: distributed under the License is distributed on an "AS IS" BASIS,
  11. :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. :: See the License for the specific language governing permissions and
  13. :: limitations under the License.
  14. if not exist "%JAVA_HOME%\bin\jps.exe" (
  15. echo Please set the JAVA_HOME variable in your environment to the correct JDK directory.
  16. echo JDK8 or later is recommended!
  17. EXIT /B 1
  18. )
  19. setlocal
  20. set "PATH=%JAVA_HOME%\bin;%PATH%"
  21. echo Killing Nacos server...
  22. :: Find and kill Nacos server process
  23. set "NACOS_RUNNING=false"
  24. for /f "tokens=1" %%i in ('jps -m ^| find "nacos.nacos"') do (
  25. set "NACOS_RUNNING=true"
  26. taskkill /F /PID %%i
  27. )
  28. if "%NACOS_RUNNING%"=="true" (
  29. echo Nacos server stopped.
  30. ) else (
  31. echo Nacos server is not running.
  32. )
  33. echo Done!