-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/openmpp/main
- Loading branch information
Showing
5 changed files
with
163 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
@echo off | ||
|
||
REM Windows: start openM++ UI from model/ompp/bin directory | ||
REM | ||
REM Environment: | ||
REM | ||
REM MODEL_NAME: model name, default: current directory name | ||
REM | ||
REM OM_ROOT: openM++ root folder, default: ..\.. | ||
REM | ||
REM OM_CFG_DEFAULT_RUN_TMPL: if defined then UI configured to use this model run template, by default | ||
REM if Release model.exe not exist and Debug modelD.exe exist then: run.Debug.template.txt | ||
REM | ||
|
||
setlocal enabledelayedexpansion | ||
|
||
REM check MODEL_NAME and OM_ROOT environment | ||
|
||
IF "%MODEL_NAME%" == "" ( | ||
@echo ERROR: empty MODEL_NAME environment variable | ||
EXIT 1 | ||
) | ||
@echo MODEL_NAME = %MODEL_NAME% | ||
|
||
IF "%OM_ROOT%" == "" ( | ||
@echo ERROR: empty OM_ROOT environment variable | ||
EXIT 1 | ||
) | ||
@echo OM_ROOT = %OM_ROOT% | ||
|
||
if not exist "%OM_ROOT%\html" ( | ||
@echo ERROR: missing UI html directory: %OM_ROOT%\html | ||
EXIT 1 | ||
) | ||
if not exist "%OM_ROOT%\bin\oms.exe" ( | ||
@echo ERROR: missing openM++ web-service: %OM_ROOT%\bin\oms.exe | ||
EXIT 1 | ||
) | ||
if not exist "%OM_ROOT%\bin\dbcopy.exe" ( | ||
@echo ERROR: missing openM++ dbcopy utility: %OM_ROOT%\bin\dbcopy.exe | ||
EXIT 1 | ||
) | ||
|
||
REM check if model.exe exist and model.sqlite exist | ||
REM if only Debug modelD.exe exist then set model run template to run.Debug.template.txt | ||
|
||
if exist "%MODEL_NAME%.exe" ( | ||
set model_exe_name=%MODEL_NAME%.exe | ||
) | ||
if not defined model_exe_name ( | ||
if exist "%MODEL_NAME%D.exe" ( | ||
|
||
set model_exe_name=%MODEL_NAME%D.exe | ||
|
||
if not defined OM_CFG_DEFAULT_RUN_TMPL ( | ||
set OM_CFG_DEFAULT_RUN_TMPL=run.Debug.template.txt | ||
) | ||
) | ||
) | ||
if not defined model_exe_name ( | ||
@echo ERROR: %MODEL_NAME% exe not found | ||
EXIT 1 | ||
) | ||
|
||
if not exist "%MODEL_NAME%.sqlite" ( | ||
@echo ERROR: model SQLite database not found: %MODEL_NAME%.sqlite | ||
EXIT 1 | ||
) | ||
|
||
REM create directories for download and upload from UI, errors are not critical and can be ignored | ||
|
||
mkdir "io\download" | ||
mkdir "io\upload" | ||
cd . | ||
|
||
REM delete oms URL file if exist | ||
|
||
set OMS_URL_TICKLE=%MODEL_NAME%.oms_url.tickle | ||
|
||
REM @echo OMS_URL_TICKLE = %OMS_URL_TICKLE% | ||
|
||
if exist "%OMS_URL_TICKLE%" ( | ||
|
||
del /q %OMS_URL_TICKLE% | ||
if ERRORLEVEL 1 ( | ||
@echo FAIL to delete: %OMS_URL_TICKLE% | ||
EXIT 1 | ||
) | ||
) | ||
if exist "%OMS_URL_TICKLE%" ( | ||
@echo FAIL to delete: %OMS_URL_TICKLE% | ||
EXIT 1 | ||
) | ||
|
||
REM start oms web-service and UI | ||
|
||
set OM_CFG_INI_ALLOW=true | ||
set OM_CFG_INI_ANY_KEY=true | ||
|
||
REM set OM_ModelName=/path/to/model/dir | ||
|
||
set model_root_name=OM_%MODEL_NAME% | ||
set %model_root_name%="%CD%" | ||
|
||
REM @echo %model_root_name% = %CD% | ||
|
||
START "oms" "%OM_ROOT%"\bin\oms.exe -l localhost:0 -oms.ModelDir ..\bin -oms.ModelLogDir ..\bin -oms.UrlSaveTo %OMS_URL_TICKLE% -oms.HtmlDir "%OM_ROOT%\html" -oms.EtcDir "%OM_ROOT%\etc" -oms.HomeDir ..\bin -oms.AllowDownload -oms.AllowUpload -oms.AllowMicrodata -oms.LogRequest -OpenM.LogToFile | ||
if ERRORLEVEL 1 ( | ||
@echo FAILED to start %OM_ROOT%\bin\oms.exe | ||
EXIT 1 | ||
) | ||
|
||
START /wait timeout /T 2 /nobreak >nul | ||
|
||
REM read oms url from file and open browser | ||
|
||
if not exist "%OMS_URL_TICKLE%" ( | ||
@echo ERROR: oms start failed, URL file not found: %OMS_URL_TICKLE% | ||
EXIT 1 | ||
) | ||
|
||
for /F "usebackq tokens=* delims=" %%i in (%OMS_URL_TICKLE%) do ( | ||
set OMS_URL=%%i | ||
) | ||
@echo Starting openM++ UI at: %OMS_URL% | ||
|
||
START %OMS_URL% |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.