diff options
Diffstat (limited to 'wininstall/script/nmsclient_shouhu.bat')
| -rw-r--r-- | wininstall/script/nmsclient_shouhu.bat | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/wininstall/script/nmsclient_shouhu.bat b/wininstall/script/nmsclient_shouhu.bat new file mode 100644 index 0000000..3f1e108 --- /dev/null +++ b/wininstall/script/nmsclient_shouhu.bat @@ -0,0 +1,77 @@ +@ECHO OFF +rem --------------------------------------------------------------------------- +rem Start ShouHu Script for the NMS Client +rem --------------------------------------------------------------------------- + +rem Guess NMSCLIENT_HOME if not defined +set "PRG_DIR=%~dp0" + + +if not "%NMSCLIENT_HOME%" == "" goto gotHome + +set "NMSCLIENT_HOME=%PRG_DIR%" +if exist "%NMSCLIENT_HOME%\bin\NMSClient.exe" goto okHome +cd /d %PRG_DIR%\.. +set "NMSCLIENT_HOME=%cd%" +cd "%PRG_DIR%" + +:gotHome +if exist "%NMSCLIENT_HOME%\bin\NMSClient.exe" goto okHome +echo The NMSCLIENT_HOME environment variable is not defined correctly +echo This environment variable is needed to run this program +goto end + +:okHome + +set "NC_TASKDIR=%1" +set "log_file=%NMSCLIENT_HOME%\temp\job.log" +echo start shouhu at: %DATE% %TIME% NC_TASKDIR:"%NC_TASKDIR%" >> "%log_file%" + +:topLoop + ping -n 50 127.0.0.1>nul + set procExist=0 + wmic process where name="NMSClient.exe" get name |findstr "NMSClient.exe">nul &&set /a procExist+=1 + echo procExist: "%procExist%" + if not "%procExist%" == "0" goto toPing + + echo Down at: %DATE% %TIME% >> "%log_file%" + + :: ---------- handler agent upgrade result + if not "%NC_TASKDIR%" == "" ( + if exist "%NC_TASKDIR%" ( + cd /d %NC_TASKDIR% + ren *.upgrade *.result >>"%log_file%" 2>&1 + cd /d %NMSCLIENT_HOME%\bin + ) + ) + + :: ---------- start NC + echo start NMSClient ... >> "%log_file%" + net start NMSClient + + :toPing + ping -n 3 127.0.0.1>nul +goto topLoop + + + + + +rem set XMS_VALUE=32 +rem set XMX_VALUE=128 +rem if exist "%NMSCLIENT_HOME%\bin\jvm.ini" ( +rem cd /d "%NMSCLIENT_HOME%\bin" +rem for /f "tokens=1,2 delims==" %%a IN (jvm.ini) Do ( +rem rem echo "Xms"=="%%a" +rem if "Xms"=="%%a" ( +rem set XMS_VALUE=%%b +rem ) +rem if "Xmx"=="%%a" ( +rem set XMX_VALUE=%%b +rem ) +rem ) +rem ) +rem set /a XMS_VALUE=%XMS_VALUE%*(1024*1024) +rem set /a XMX_VALUE=%XMX_VALUE%*(1024*1024) + +rem start "" "%NMSCLIENT_HOME%\bin\NMSClient.exe" -Jinitialheap=%XMS_VALUE% -Jmaxheap=%XMX_VALUE%
\ No newline at end of file |
