[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-1122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17386839#comment-17386839
 ] 

Kok-Hoon Teo edited comment on ZOOKEEPER-1122 at 7/25/21, 9:06 AM:
-------------------------------------------------------------------

Hi all,

Here's an improved version of "zkServerStop.cmd" that avoids "Error 1067: The 
process terminated unexpectedly" when used in "prunsrv.exe". It must be saved 
in the same "bin" directory as "zkEnv.cmd"

 
{code:java}
@echo off
setlocal
call "%~dp0zkEnv.cmd"

@REM escape back-slashes for wmic query
SET ZOOCFG_ESC=%ZOOCFG:\=\\%
SET TMP_PID_FILE=java.pid

@REM query for java process with commandline containing %ZOOCFG%
wmic process where 'commandline like "%%java.exe%%%ZOOCFG_ESC%%%"'  get 
processid | findstr /r /c:"[0-9]" > %TMP_PID_FILE%

FOR /F "tokens=*" %%F IN (%TMP_PID_FILE%) DO (
    @SET javaPID=%%F
)
if defined javaPID (taskkill /F /T /PID %javaPID%)

del %TMP_PID_FILE%
endlocal


{code}
 


was (Author: kokhoon):
Hi all,

Here's an improved version of zkServerStop.cmd that avoids "Error 1067: The 
process terminated unexpectedly". It must be saved in the same "bin" directory 
as "zkEnv.cmd"

 
{code:java}
@echo off
setlocal
call "%~dp0zkEnv.cmd"

@REM escape back-slashes for wmic query
SET ZOOCFG_ESC=%ZOOCFG:\=\\%
SET TMP_PID_FILE=java.pid

@REM query for java process with commandline containing %ZOOCFG%
wmic process where 'commandline like "%%java.exe%%%ZOOCFG_ESC%%%"'  get 
processid | findstr /r /c:"[0-9]" > %TMP_PID_FILE%

FOR /F "tokens=*" %%F IN (%TMP_PID_FILE%) DO (
    @SET javaPID=%%F
)
if defined javaPID (taskkill /F /T /PID %javaPID%)

del %TMP_PID_FILE%
endlocal


{code}
 

> "start" and "stop" commands are not present in zkServer.cmd
> -----------------------------------------------------------
>
>                 Key: ZOOKEEPER-1122
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1122
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: scripts
>    Affects Versions: 3.3.3
>         Environment: Windows
>            Reporter: Alexander Osadchiy
>            Priority: Major
>              Labels: patch
>             Fix For: 3.8.0
>
>         Attachments: zkServer.cmd, zkServer.cmd
>
>
> Now ZooKeeper server can be started and stoped from Unix-based systems using 
> script "bin/zkServer.sh":
> bin/zkServer.sh start - to start server;
> bin/zkServer.sh stop - to stop server.
> There are no "start" and "stop" commands in script "zkServer.cmd" (for 
> Windows).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to