exec.bat 1.2 KB
Newer Older
S
TD-1207  
Shengliang Guan 已提交
1
@echo off
S
TD-1207  
Shengliang Guan 已提交
2

S
TD-1207  
Shengliang Guan 已提交
3
rem echo Executing exec.sh
S
TD-1207  
Shengliang Guan 已提交
4

S
TD-1207  
Shengliang Guan 已提交
5 6 7 8
if %1 == -n set NODE_NAME=%2
if %1 == -s set EXEC_OPTON=%2
if %3 == -n set NODE_NAME=%4
if %3 == -s set EXEC_OPTON=%4
S
TD-1207  
Shengliang Guan 已提交
9

S
TD-1207  
Shengliang Guan 已提交
10 11
rem echo NODE_NAME:  %NODE_NAME%
rem echo NODE:       %EXEC_OPTON%
S
TD-1207  
Shengliang Guan 已提交
12

S
TD-1207  
Shengliang Guan 已提交
13 14
set SCRIPT_DIR=%~dp0..\
rem echo SCRIPT_DIR: %SCRIPT_DIR%
S
TD-1207  
Shengliang Guan 已提交
15

S
TD-1207  
Shengliang Guan 已提交
16 17 18 19
set BUILD_DIR=%SCRIPT_DIR%..\..\..\debug\build\bin\
set TAOSD=%BUILD_DIR%taosd
rem echo BUILD_DIR:  %BUILD_DIR%
rem echo TAOSD:      %TAOSD%
S
TD-1207  
Shengliang Guan 已提交
20

S
TD-1207  
Shengliang Guan 已提交
21 22
set SIM_DIR=%SCRIPT_DIR%..\..\..\sim\
rem echo SIM_DIR:    %SIM_DIR%
S
TD-1207  
Shengliang Guan 已提交
23

S
TD-1207  
Shengliang Guan 已提交
24 25
set NODE_DIR=%SIM_DIR%%NODE_NAME%\
rem echo NODE_DIR:   %NODE_DIR%
S
TD-1207  
Shengliang Guan 已提交
26

S
TD-1207  
Shengliang Guan 已提交
27 28
set CFG_DIR=%NODE_DIR%cfg\
rem echo CFG_DIR:    %CFG_DIR%
S
TD-1207  
Shengliang Guan 已提交
29

S
TD-1207  
Shengliang Guan 已提交
30 31
set TAOS_CFG=%CFG_DIR%taos.cfg
rem echo TAOS_CFG:   %TAOS_CFG%
S
TD-1207  
Shengliang Guan 已提交
32

S
TD-1207  
Shengliang Guan 已提交
33 34 35 36
if %EXEC_OPTON% == start (
  echo start %TAOSD% -c %CFG_DIR%
  start %TAOSD% -c %CFG_DIR%
)
S
TD-1207  
Shengliang Guan 已提交
37

S
TD-1207  
Shengliang Guan 已提交
38 39
if %EXEC_OPTON% == stop (
  rem echo wmic process where "name='taosd.exe' and CommandLine like '%%%NODE_NAME%%%'" list INSTANCE
S
TD-1207  
Shengliang Guan 已提交
40 41 42 43 44 45 46 47
  rem wmic process where "name='taosd.exe' and CommandLine like '%%%NODE_NAME%%%'" call terminate > NUL 2>&1
  
  for /f "tokens=1 skip=1" %%A in (
    'wmic process where "name='taosd.exe'" get processId '
  ) do (
    rem echo taskkill /IM %%A 
    taskkill /IM %%A > NUL 2>&1
  )
S
TD-1207  
Shengliang Guan 已提交
48
)