Commit f94aee19ab3f6ba89e65b811a0364ddc5e5fb947
Committed by
GitHub
Merge pull request #312 from mp-loki/master
install_dev_db scripts error code fixed
Showing
4 changed files
with
25 additions
and
8 deletions
... | ... | @@ -16,6 +16,7 @@ |
16 | 16 | |
17 | 17 | package org.thingsboard.server; |
18 | 18 | |
19 | +import lombok.extern.slf4j.Slf4j; | |
19 | 20 | import org.springframework.boot.SpringApplication; |
20 | 21 | import org.springframework.boot.SpringBootConfiguration; |
21 | 22 | import org.springframework.context.ConfigurableApplicationContext; |
... | ... | @@ -24,6 +25,7 @@ import org.thingsboard.server.install.ThingsboardInstallService; |
24 | 25 | |
25 | 26 | import java.util.Arrays; |
26 | 27 | |
28 | +@Slf4j | |
27 | 29 | @SpringBootConfiguration |
28 | 30 | @ComponentScan({"org.thingsboard.server.install", |
29 | 31 | "org.thingsboard.server.service.component", |
... | ... | @@ -35,10 +37,15 @@ public class ThingsboardInstallApplication { |
35 | 37 | private static final String DEFAULT_SPRING_CONFIG_PARAM = SPRING_CONFIG_NAME_KEY + "=" + "thingsboard"; |
36 | 38 | |
37 | 39 | public static void main(String[] args) { |
38 | - SpringApplication application = new SpringApplication(ThingsboardInstallApplication.class); | |
39 | - application.setAdditionalProfiles("install"); | |
40 | - ConfigurableApplicationContext context = application.run(updateArguments(args)); | |
41 | - context.getBean(ThingsboardInstallService.class).performInstall(); | |
40 | + try { | |
41 | + SpringApplication application = new SpringApplication(ThingsboardInstallApplication.class); | |
42 | + application.setAdditionalProfiles("install"); | |
43 | + ConfigurableApplicationContext context = application.run(updateArguments(args)); | |
44 | + context.getBean(ThingsboardInstallService.class).performInstall(); | |
45 | + } catch (Exception e) { | |
46 | + log.error(e.getMessage()); | |
47 | + System.exit(1); | |
48 | + } | |
42 | 49 | } |
43 | 50 | |
44 | 51 | private static String[] updateArguments(String[] args) { | ... | ... |
... | ... | @@ -48,6 +48,14 @@ |
48 | 48 | <appender-ref ref="STDOUT" /> |
49 | 49 | </logger> |
50 | 50 | |
51 | + <logger name="org.thingsboard.server.ThingsboardInstallApplication" level="ERROR"> | |
52 | + <appender-ref ref="STDOUT" /> | |
53 | + </logger> | |
54 | + | |
55 | + <logger name="org.apache.tomcat.jdbc.pool" level="ERROR"> | |
56 | + <appender-ref ref="STDOUT" /> | |
57 | + </logger> | |
58 | + | |
51 | 59 | <logger name="org.thingsboard.server" level="INFO" /> |
52 | 60 | <logger name="akka" level="INFO" /> |
53 | 61 | ... | ... |
... | ... | @@ -4,12 +4,14 @@ setlocal ENABLEEXTENSIONS |
4 | 4 | |
5 | 5 | SET BASE=${project.basedir}\target |
6 | 6 | SET LOADER_PATH=%BASE%\conf,%BASE%\extensions |
7 | -SET SQL_DATA_FOLDER=%~dp0\tmp | |
7 | + | |
8 | 8 | SET jarfile=%BASE%\thingsboard-${project.version}-boot.jar |
9 | 9 | SET installDir=%BASE%\data |
10 | 10 | SET loadDemo=true |
11 | 11 | |
12 | -SET SQL_DATA_FOLDER=/tmp | |
12 | +IF "%SQL_DATA_FOLDER%" == "" ( | |
13 | + SET SQL_DATA_FOLDER=/tmp | |
14 | +) | |
13 | 15 | |
14 | 16 | java -cp %jarfile% -Dloader.main=org.thingsboard.server.ThingsboardInstallApplication^ |
15 | 17 | -Dinstall.data_dir=%installDir%^ |
... | ... | @@ -19,7 +21,7 @@ java -cp %jarfile% -Dloader.main=org.thingsboard.server.ThingsboardInstallApplic |
19 | 21 | -Dlogging.config=%BASE%\windows\install\logback.xml^ |
20 | 22 | org.springframework.boot.loader.PropertiesLauncher |
21 | 23 | |
22 | -if NOT errorlevel == 0 ( | |
24 | +if errorlevel 1 ( | |
23 | 25 | @echo ThingsBoard DB installation failed! |
24 | 26 | POPD |
25 | 27 | exit /b %errorlevel% | ... | ... |