summaryrefslogtreecommitdiff
path: root/wininstall/script
diff options
context:
space:
mode:
authorchenjinsong <[email protected]>2018-09-27 16:17:06 +0800
committerchenjinsong <[email protected]>2018-09-27 16:17:06 +0800
commit9b3c3ac5d7828b348558012f6167527459310f21 (patch)
tree4c8e31f5445ae85b8100e1e7e2f1cba28fca9136 /wininstall/script
initial commitHEADmaster
Diffstat (limited to 'wininstall/script')
-rw-r--r--wininstall/script/restart.bat77
-rw-r--r--wininstall/script/writepid.bat32
2 files changed, 109 insertions, 0 deletions
diff --git a/wininstall/script/restart.bat b/wininstall/script/restart.bat
new file mode 100644
index 0000000..7ebc08f
--- /dev/null
+++ b/wininstall/script/restart.bat
@@ -0,0 +1,77 @@
+@ECHO OFF
+rem ---------------------------------------------------------------------------
+rem Start Script for the NMS DataController
+rem ---------------------------------------------------------------------------
+
+rem Guess DATACONTROLLER_HOME if not defined
+set "PRG_DIR=%~dp0"
+
+
+if not "%DATACONTROLLER_HOME%" == "" goto gotHome
+
+set "DATACONTROLLER_HOME=%PRG_DIR%"
+if exist "%DATACONTROLLER_HOME%\bin\DataController.exe" goto okHome
+cd /d %PRG_DIR%\..
+set "DATACONTROLLER_HOME=%cd%"
+cd "%PRG_DIR%"
+
+:gotHome
+if exist "%DATACONTROLLER_HOME%\bin\DataController.exe" goto okHome
+echo The DATACONTROLLER_HOME environment variable is not defined correctly
+echo This environment variable is needed to run this program
+goto end
+
+:okHome
+
+echo DATACONTROLLER_HOME: %DATACONTROLLER_HOME%
+set "wtitle=DataController"
+set "_NAME=DataController.exe"
+
+set procExist=0
+wmic process where name="%_NAME%" get name |findstr "%_NAME%">nul &&set /a procExist+=1
+if not "%procExist%" == "0" goto stopProc
+echo %wtitle% is not start, now start......
+goto startProc
+
+:stopProc
+echo %wtitle% is start, now restart......
+wmic process where name="%_NAME%" delete >nul
+ping -n 3 127.0.0.1>nul
+
+:startProc
+set XMS_VALUE=32
+set XMX_VALUE=128
+if exist "%DATACONTROLLER_HOME%\bin\jvm.ini" (
+cd /d "%DATACONTROLLER_HOME%\bin"
+for /f "tokens=1,2 delims==" %%a IN (jvm.ini) Do (
+ rem echo "Xms"=="%%a"
+
+ if "Xms"=="%%a" (
+ set XMS_VALUE=%%b
+ )
+)
+
+for /f "tokens=1,2 delims==" %%c IN (jvm.ini) Do (
+ rem echo "Xmx"=="%%c"
+ if "Xmx"=="%%c" (
+ set XMX_VALUE=%%d
+ )
+)
+cd "%PRG_DIR%"
+)
+rem echo %XMS_VALUE%
+rem echo %XMX_VALUE%
+set /a XMS_VALUE=%XMS_VALUE%*(1024*1024)
+set /a XMX_VALUE=%XMX_VALUE%*(1024*1024)
+rem echo %XMS_VALUE%
+rem echo %XMX_VALUE%
+
+
+start "" "%DATACONTROLLER_HOME%\bin\DataController.exe" -Jinitialheap=%XMS_VALUE% -Jmaxheap=%XMX_VALUE%
+set startOk=0
+ping -n 3 127.0.0.1>nul
+wmic process where name="%_NAME%" get name |findstr "%_NAME%">nul &&set /a startOk+=1
+if not "%startOk%" == "1" goto handleTask
+goto end
+
+:end \ No newline at end of file
diff --git a/wininstall/script/writepid.bat b/wininstall/script/writepid.bat
new file mode 100644
index 0000000..4d4c4a0
--- /dev/null
+++ b/wininstall/script/writepid.bat
@@ -0,0 +1,32 @@
+@ECHO OFF
+rem ---------------------------------------------------------------------------
+rem Write PID Script for the the DATADONTROLLER
+rem ---------------------------------------------------------------------------
+set "PRG_DIR=%~dp0"
+
+if not "%DC_HOME%" == "" goto gotHome
+
+set "DC_HOME=%PRG_DIR%"
+if exist "%DC_HOME%\bin\DataController.exe" goto okHome
+cd /d %PRG_DIR%\..
+set "DC_HOME=%cd%"
+cd "%PRG_DIR%"
+
+:gotHome
+if exist "%DC_HOME%\bin\DataController.exe" goto okHome
+echo The DC_HOME environment variable is not defined correctly
+echo This environment variable is needed to run this program
+goto end
+
+:okHome
+if not exist "%DC_HOME%\temp" (
+ cd %DC_HOME%
+ mkdir temp
+ cd %DC_HOME%\script
+)
+
+set "_NAME=DataController.exe"
+wmic process where name="%_NAME%" get processId |findStr /v "ProcessId" |findstr /v "findstr" >"%DC_HOME%\temp\DataControllerPid.temp"
+
+:end
+exit 0