forked from informatici/openhospital-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
oh.bat
381 lines (313 loc) · 16.4 KB
/
oh.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
@echo off
REM # Open Hospital (www.open-hospital.org)
REM # Copyright © 2006-2024 Informatici Senza Frontiere ([email protected])
REM #
REM # Open Hospital is a free and open source software for healthcare data management.
REM #
REM # This program is free software: you can redistribute it and/or modify
REM # it under the terms of the GNU General Public License as published by
REM # the Free Software Foundation, either version 3 of the License, or
REM # (at your option) any later version.
REM #
REM # https://www.gnu.org/licenses/gpl-3.0-standalone.html
REM #
REM # This program is distributed in the hope that it will be useful,
REM # but WITHOUT ANY WARRANTY; without even the implied warranty of
REM # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
REM # GNU General Public License for more details.
REM #
REM # You should have received a copy of the GNU General Public License
REM # along with this program. If not, see <https://www.gnu.org/licenses/>.
REM #
REM ################### Script configuration ###################
REM
REM set LEGACYMODE=on to start with legacy oh.bat script
REM
REM launch oh.bat -h to see available options
REM
REM -> default startup script called is oh.ps1 (powershell) <-
REM
set LEGACYMODE="off"
REM ############################################################
REM check for legacy mode
if %LEGACYMODE%=="on" goto legacy
REM ###### Functions and script start
goto :init
:header
echo.
echo Open Hospital startup script
echo %__BAT_NAME% v%__SCRIPTVERSION%
echo.
goto :eof
:usage
echo USAGE:
echo %__BAT_NAME% [-option]
echo.
echo. -h, -?, --help shows this help
echo. -legacymode, --legacymode start OH with legacy oh.bat
goto :eof
:init
set "__SCRIPTVERSION=1.0"
set "__BAT_FILE=%~0"
set "__BAT_PATH=%~dp0"
set "__BAT_NAME=%~nx0"
:parse
if "%~1"=="" goto :main
if /i "%~1"=="/?" call :header & call :usage & goto :end
if /i "%~1"=="-?" call :header & call :usage & goto :end
if /i "%~1"=="-h" call :header & call :usage & goto :end
if /i "%~1"=="-help" call :header & call :usage & goto :end
if /i "%~1"=="--help" call :header & call :usage & goto :end
if /i "%~1"=="/legacymode" call :legacy & goto :end
if /i "%~1"=="-legacymode" call :legacy & goto :end
if /i "%~1"=="--legacymode" call :legacy & goto :end
shift
goto :parse
:main
REM ################### oh.ps1 ###################
REM default startup script called: oh.ps1
echo Starting OH with oh.ps1...
REM launch powershell script
powershell.exe -ExecutionPolicy Bypass -File ./oh.ps1
goto end
:legacy
REM ############################# Legacy oh.bat ############################
echo Legacy mode - Starting OH with oh.bat...
REM ################### Open Hospital Configuration ###################
REM #
REM # ___Warning___
REM #
REM # __this configuration parameters work ONLY for legacy mode__
REM #
REM # _for normal startup, please edit oh.ps1__
REM #
REM ###################
set OH_PATH=%~dps0
REM ########## set mode #########
REM set OH_MODE = PORTABLE SERVER CLIENT
set OH_MODE="PORTABLE"
REM ########## set language #########
REM # Language setting - default set to en
REM set OH_LANGUAGE=en fr es it pt ar
set OH_LANGUAGE=en
REM # set log level to INFO | DEBUG - default set to INFO
set LOG_LEVEL=INFO
REM ##################### Database configuration #######################
set DATABASE_SERVER=localhost
set DATABASE_PORT=3306
set DATABASE_ROOT_PW=tmp2021oh111
set DATABASE_NAME=oh
set DATABASE_USER=isf
set DATABASE_PASSWORD=isf123
REM ####################### OH configuration #########################
REM # path and directories
set OH_DIR="."
set OH_DOC_DIR="..\doc"
set OH_SINGLE_USER="no"
set CONF_DIR="data\conf"
set DATA_DIR="data\db"
set PHOTO_DIR="data\photo"
set LOG_DIR="data\log"
set SQL_DIR="sql"
set SQL_EXTRA="sql\extra"
set TMP_DIR="tmp"
REM # imagingin / dicom
set DICOM_MAX_SIZE="4M"
set DICOM_STORAGE="FileSystemDicomManager"
set DICOM_DIR="data\dicom_storage"
REM # logging
set LOG_FILE=startup.log
set OH_LOG_FILE=openhospital.log
set DB_CREATE_SQL=create_all_en.sql
REM #-> DB_CREATE_SQL default is set to create_all_en.sql - set to "create_all_demo.sql" for demo or create_all_[lang].sql for language
REM ######## Architecture
REM # ARCH can be set to i686 (32 bit) or x64 (64bit)
REM set ARCH=i686
set ARCH=x64
REM ######## MySQL Software
REM # MariaDB 64bit download URL
REM https://archive.mariadb.org/mariadb-10.6.16/winx64-packages/mariadb-10.6.16-winx64.zip
REM # MariaDB 32bit download URL
REM https://archive.mariadb.org/mariadb-10.6.5/win32-packages/mariadb-10.6.5-win32.zip
REM set MYSQL_DIR=mariadb-10.6.5-win%ARCH%
set MYSQL_DIR=mariadb-10.6.16-win%ARCH%
REM ####### JAVA Software
REM # JRE 11 64bit - x86_64 - openjdk
REM set JAVA_URL="https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.11%2B9/"
REM set JAVA_DISTRO="OpenJDK11U-jre_x64_windows_hotspot_11.0.11_9.zip"
REM # JRE 8 32bit - i686 - zulu
REM set JAVA_DIR=zulu8.60.0.21-ca-jre8.0.322-win_i686
REM set JAVA_BIN=%OH_PATH%\%JAVA_DIR%\bin\java.exe
REM # JRE 11 32bit - i686 - zulu - default
set JAVA_DIR=zulu17.48.15-ca-jre17.0.10-win_%ARCH%
set JAVA_BIN=%OH_PATH%\%JAVA_DIR%\bin\java.exe
set REPLACE_PATH=%OH_PATH%\%MYSQL_DIR%\bin
REM ######## Script start
REM set path variable with / in place of \ for configuration file
set OH_PATH_SUBSTITUTE=%OH_PATH:\=/%
echo Configuring Open Hospital...
REM # Set mysql TCP port
set startPort=%DATABASE_PORT%
:searchport
netstat -o -n -a | find "LISTENING" | find ":%startPort% " > NUL
if "%ERRORLEVEL%" equ "0" (
echo TCP port %startPort% unavailable
set /a startPort +=1
goto :searchport
) ELSE (
echo TCP port %startPort% available
set DATABASE_PORT=%startPort%
goto :foundport
)
:foundport
echo Found TCP port %DATABASE_PORT% for MySQL !
REM # Create tmp and log dir
mkdir "%OH_PATH%\%TMP_DIR%"
mkdir "%OH_PATH%\%LOG_DIR%"
echo Generating MySQL config file...
REM ### Setup MySQL configuration
echo f | xcopy %OH_PATH%\%CONF_DIR%\my.cnf.dist %OH_PATH%\%CONF_DIR%\my.cnf /y > "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe OH_PATH_SUBSTITUTE %OH_PATH_SUBSTITUTE% -- %OH_PATH%\%CONF_DIR%\my.cnf >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe DATABASE_SERVER %DATABASE_SERVER% -- %OH_PATH%\%CONF_DIR%\my.cnf >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe DATABASE_PORT %DATABASE_PORT% -- %OH_PATH%\%CONF_DIR%\my.cnf >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe MYSQL_DISTRO %MYSQL_DIR% -- %OH_PATH%\%CONF_DIR%\my.cnf >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe DICOM_SIZE %DICOM_MAX_SIZE% -- %OH_PATH%\%CONF_DIR%\my.cnf >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe TMP_DIR %TMP_DIR% -- %OH_PATH%\%CONF_DIR%\my.cnf >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe DATA_DIR %DATA_DIR% -- %OH_PATH%\%CONF_DIR%\my.cnf >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe LOG_DIR %LOG_DIR% -- %OH_PATH%\%CONF_DIR%\my.cnf >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
echo Generating OH configuration files...
REM ### Setup dicom.properties
echo f | xcopy %OH_PATH%\%OH_DIR%\rsc\dicom.properties.dist %OH_PATH%\%OH_DIR%\rsc\dicom.properties /y >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe OH_PATH_SUBSTITUTE %OH_PATH_SUBSTITUTE% -- %OH_PATH%\%OH_DIR%\rsc\dicom.properties >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe DICOM_SIZE %DICOM_MAX_SIZE% -- %OH_PATH%\%OH_DIR%\rsc\dicom.properties >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe DICOM_STORAGE %DICOM_STORAGE% -- %OH_PATH%\%OH_DIR%\rsc\dicom.properties >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe DICOM_DIR %DICOM_DIR% -- %OH_PATH%\%OH_DIR%\rsc\dicom.properties >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
REM ### Setup database.properties
echo f | xcopy %OH_PATH%\%OH_DIR%\rsc\database.properties.dist %OH_PATH%\%OH_DIR%\rsc\database.properties /y >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe DBSERVER %DATABASE_SERVER% -- %OH_PATH%\%OH_DIR%\rsc\database.properties >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe DBPORT %DATABASE_PORT% -- %OH_PATH%\%OH_DIR%\rsc\database.properties >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe DBUSER %DATABASE_USER% -- %OH_PATH%\%OH_DIR%\rsc\database.properties >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe DBPASS %DATABASE_PASSWORD% -- %OH_PATH%\%OH_DIR%\rsc\database.properties >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe DBNAME %DATABASE_NAME% -- %OH_PATH%\%OH_DIR%\rsc\database.properties >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
REM ### Setup settings.properties
echo f | xcopy %OH_PATH%\%OH_DIR%\rsc\settings.properties.dist %OH_PATH%\%OH_DIR%\rsc\settings.properties /y >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe OH_MODE %OH_MODE% -- %OH_PATH%\%OH_DIR%\rsc\settings.properties >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe OH_LANGUAGE %OH_LANGUAGE% -- %OH_PATH%\%OH_DIR%\rsc\settings.properties >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe OH_DOC_DIR %OH_DOC_DIR% -- %OH_PATH%\%OH_DIR%\rsc\settings.properties >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe PHOTO_DIR %PHOTO_DIR% -- %OH_PATH%\%OH_DIR%\rsc\settings.properties >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe YES_OR_NO %OH_SINGLE_USER% -- %OH_PATH%\%OH_DIR%\rsc\settings.properties >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
REM ### Setup log4j2-spring.properties
REM # replace backslash with slash
set OH_LOG_DIR=%LOG_DIR:\=/%
set OH_LOG_DEST=../%OH_LOG_DIR%/%OH_LOG_FILE%
echo f | xcopy %OH_PATH%\%OH_DIR%\rsc\log4j2-spring.properties.dist %OH_PATH%\%OH_DIR%\rsc\log4j2-spring.properties /y >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe DBSERVER %DATABASE_SERVER% -- %OH_PATH%\%OH_DIR%\rsc\log4j2-spring.properties >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe DBPORT %DATABASE_PORT% -- %OH_PATH%\%OH_DIR%\rsc\log4j2-spring.properties >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe DBUSER %DATABASE_USER% -- %OH_PATH%\%OH_DIR%\rsc\log4j2-spring.properties >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe DBPASS %DATABASE_PASSWORD% -- %OH_PATH%\%OH_DIR%\rsc\log4j2-spring.properties >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe DBNAME %DATABASE_NAME% -- %OH_PATH%\%OH_DIR%\rsc\log4j2-spring.properties >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe LOG_LEVEL %LOG_LEVEL% -- %OH_PATH%\%OH_DIR%\rsc\log4j2-spring.properties >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
%REPLACE_PATH%\replace.exe LOG_DEST %OH_LOG_DEST% -- %OH_PATH%\%OH_DIR%\rsc\log4j2-spring.properties >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
REM ### Setup other OH property files
echo f | xcopy %OH_PATH%\%OH_DIR%\rsc\examination.properties.dist %OH_PATH%\%OH_DIR%\rsc\examination.properties /y >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
echo f | xcopy %OH_PATH%\%OH_DIR%\rsc\sms.properties.dist %OH_PATH%\%OH_DIR%\rsc\sms.properties /y >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
echo f | xcopy %OH_PATH%\%OH_DIR%\rsc\txtPrinter.properties.dist %OH_PATH%\%OH_DIR%\rsc\txtPrinter.properties /y >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
echo f | xcopy %OH_PATH%\%OH_DIR%\rsc\telemetry.properties.dist %OH_PATH%\%OH_DIR%\rsc\telemetry.properties /y >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
echo f | xcopy %OH_PATH%\%OH_DIR%\rsc\xmpp.properties.dist %OH_PATH%\%OH_DIR%\rsc\xmpp.properties /y >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
echo f | xcopy %OH_PATH%\%OH_DIR%\rsc\default_credentials.properties.dist %OH_PATH%\%OH_DIR%\rsc\default_credentials.properties /y >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
REM echo f | xcopy %OH_PATH%\%OH_DIR%\rsc\default_demo_credentials.properties.dist %OH_PATH%\%OH_DIR%\rsc\default_demo_credentials.properties /y >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
REM ### Setup database if not already existing
if not EXIST %OH_PATH%\%DATA_DIR%\%DATABASE_NAME% (
REM # Remove database files
echo Removing data...
rmdir /s /q %OH_PATH%\%DATA_DIR%
REM # Create directories
mkdir "%OH_PATH%\%DATA_DIR%"
mkdir "%OH_PATH%\%TMP_DIR%"
mkdir "%OH_PATH%\%LOG_DIR%"
mkdir "%OH_PATH%\%DICOM_DIR%"
mkdir "%OH_PATH%\%PHOTO_DIR%"
del /s /q %OH_PATH%\%TMP_DIR%\*
if %MYSQL_DIR:~0,5% == maria (
echo Initializing MariaDB...
start /b /min /wait %OH_PATH%\%MYSQL_DIR%\bin\mysql_install_db.exe --datadir=%OH_PATH%\%DATA_DIR% --password=%DATABASE_ROOT_PW% >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
)
if %MYSQL_DIR:~0,5% == mysql (
echo Initializing MySQL...
start /b /min /wait %OH_PATH%\%MYSQL_DIR%\bin\mysqld.exe --initialize-insecure --console --basedir="%OH_PATH%\%MYSQL_DIR%" --datadir="%OH_PATH%\%DATA_DIR%"
)
if ERRORLEVEL 1 (goto error)
echo Starting MySQL server on port %DATABASE_PORT%...
start /b /min %OH_PATH%\%MYSQL_DIR%\bin\mysqld.exe --defaults-file=%OH_PATH%\%CONF_DIR%\my.cnf --tmpdir=%OH_PATH%\%TMP_DIR% --standalone --console
if ERRORLEVEL 1 (goto error)
timeout /t 2 /nobreak >nul
REM # If using MySQL root password need to be set
if %MYSQL_DIR:~0,5% == mysql (
echo Setting MySQL root password...
start /b /min /wait %OH_PATH%\%MYSQL_DIR%\bin\mysql.exe -u root --skip-password --host=%DATABASE_SERVER% --port=%DATABASE_PORT% -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '%DATABASE_ROOT_PW%';" >> %OH_PATH%\%LOG_DIR%\%LOG_FILE% 2>&1
if ERRORLEVEL 1 (goto error)
)
echo Creating database...
start /b /min /wait %OH_PATH%\%MYSQL_DIR%\bin\mysql.exe -u root -p%DATABASE_ROOT_PW% --host=%DATABASE_SERVER% --port=%DATABASE_PORT% -e "CREATE USER '%DATABASE_USER%'@'localhost' IDENTIFIED BY '%DATABASE_PASSWORD%'; CREATE DATABASE %DATABASE_NAME% CHARACTER SET utf8; GRANT ALL PRIVILEGES ON %DATABASE_NAME%.* TO '%DATABASE_USER%'@'localhost' IDENTIFIED BY '%DATABASE_PASSWORD%';" >> %OH_PATH%\%LOG_DIR%\%LOG_FILE% 2>&1
if ERRORLEVEL 1 (goto error)
echo Importing database %DATABASE_NAME% with user %DATABASE_USER%@%DATABASE_SERVER%...
cd /d %OH_PATH%\%SQL_DIR%
start /b /min /wait %OH_PATH%\%MYSQL_DIR%\bin\mysql.exe --local-infile=1 -u %DATABASE_USER% -p%DATABASE_PASSWORD% --host=%DATABASE_SERVER% --port=%DATABASE_PORT% %DATABASE_NAME% < "%OH_PATH%\sql\%DB_CREATE_SQL%" >> "%OH_PATH%\%LOG_DIR%\%LOG_FILE%" 2>&1
if ERRORLEVEL 1 (goto error)
cd /d %OH_PATH%
echo Database imported!
) else (
echo Database already initialized, trying to start...
echo Starting MySQL server on port %DATABASE_PORT%...
start /b /min %OH_PATH%\%MYSQL_DIR%\bin\mysqld.exe --defaults-file=%OH_PATH%\%CONF_DIR%\my.cnf --tmpdir=%OH_PATH%\%TMP_DIR% --standalone --console
if ERRORLEVEL 1 (goto error)
)
REM ###### Setup CLASSPATH #####
set CLASSPATH=%OH_PATH%\%OH_DIR%\lib
SETLOCAL ENABLEDELAYEDEXPANSION
REM Include all jar files under lib\
for %%A IN (%OH_PATH%\%OH_DIR%\lib\*.jar) DO (
set CLASSPATH=!CLASSPATH!;%%A
)
set CLASSPATH=%CLASSPATH%;%OH_PATH%\%OH_DIR%\bundle
set CLASSPATH=%CLASSPATH%;%OH_PATH%\%OH_DIR%\rpt_base
set CLASSPATH=%CLASSPATH%;%OH_PATH%\%OH_DIR%\rpt_extra
set CLASSPATH=%CLASSPATH%;%OH_PATH%\%OH_DIR%\rpt_stat
set CLASSPATH=%CLASSPATH%;%OH_PATH%\%OH_DIR%\rsc
set CLASSPATH=%CLASSPATH%;%OH_PATH%\%OH_DIR%\rsc\images
REM set CLASSPATH=%CLASSPATH%;%OH_PATH%\%OH_DIR%\rsc\icons REM hardcoded
set CLASSPATH=%CLASSPATH%;%OH_PATH%\%OH_DIR%\bin\OH-gui.jar
REM # Setup native_lib_path for current architecture
if %PROCESSOR_ARCHITECTURE%==AMD64 if not %ARCH%==32 (
set NATIVE_LIB_PATH=%OH_PATH%\%OH_DIR%\lib\native\Win64
) else (
set NATIVE_LIB_PATH=%OH_PATH%\%OH_DIR%\lib\native\Windows
)
REM ###### Start Open Hospital #####
echo Starting Open Hospital GUI...
cd /d %OH_PATH%\%OH_DIR%
%JAVA_BIN% -client -Xms64m -Xmx1024m -Dsun.java2d.dpiaware=false -Djava.library.path=%NATIVE_LIB_PATH% -cp %CLASSPATH% org.isf.Application
REM # Shutdown MySQL
echo Shutting down MySQL...
start /b /min /wait %OH_PATH%\%MYSQL_DIR%\bin\mysqladmin --user=root --password=%DATABASE_ROOT_PW% --host=%DATABASE_SERVER% --port=%DATABASE_PORT% shutdown >> %OH_PATH%\%LOG_DIR%\%LOG_FILE% 2>&1
REM # Exit
echo Exiting Open Hospital...
cd /d %OH_PATH%
echo Done !
goto end
:error
echo Error starting Open Hospital, exiting.
cd /d %OH_PATH%
goto end
:end
call :cleanup
exit /B
:cleanup
REM The cleanup function is only really necessary if you
REM are _not_ using SETLOCAL.
set "__SCRIPTVERSION="
set "__BAT_FILE="
set "__BAT_PATH="
set "__BAT_NAME="
set "LEGACYMODE="
goto :eof