forked from zeljko00/iot-gateway-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexe_script.bat
89 lines (70 loc) · 1.8 KB
/
exe_script.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
@echo off
setlocal EnableDelayedExpansion
title Windows Activation Script
set postgres_username=
set postgres_password=
if "%~1" == "" (
echo Error - No parameters provided
goto end
)
set argC=0
for %%x in (%*) do Set /A argC+=1
if NOT "%argC%" == "4" (
echo Error - Not all parameters provided
goto end
)
if /I "%~1" == "-postgres_username" (
set postgres_username=%2
shift
shift
) else (
echo Error - Postgres username parameter naming error
goto end
)
if /I "%~1" == "-postgres_password" (
set postgres_password=%2
shift
shift
) else (
echo Error - Postgres password parameter naming error
goto end
)
echo Starting mosquitto brokers...
cd mosquitto
start "Sensors Mosquitto" mosquitto -c mosquitto1.conf
start "Gateway Mosquitto" mosquitto -c mosquitto2.conf
cd ..
echo Mosquitto brokers started!
set "POSTGRESQL_URL=jdbc:postgresql://localhost:5432/iot-platform-database"
set "POSTGRESQL_USER=!postgres_username!"
set "POSTGRESQL_PASSWORD=!postgres_password!"
set "CLOUD_MQTT_CLIENT_ID=my_test_cloud_client"
set "REACT_APP_API_URL=http://localhost:8080/iot-cloud-platform"
set "HISTORY=1"
echo Setting up database...
psql -U postgres -c "CREATE DATABASE \"iot-platform-database\"" > nul 2> nul
psql -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE \"iot-platform-database\" TO postgres" > nul 2> nul
echo Database ready!
echo Starting Cloud App...
cd cloud
start "Cloud App" java -jar app.jar
cd ..
echo Cloud App ready!
cd src
echo Starting CAN Client...
start "CAN Dispatcher" python.exe "can_service.py"
echo CAN Started!
echo Starting IoT Gateway...
start "IoT Gateway" python.exe "app.py"
echo IoT Gateway started!
start "REST API" python.exe "rest_api.py"
cd ..
cd ..
cd iot-cloud-dashboard
npm start
echo System is running!
goto clean_end
:end
echo Exiting script!
exit /b 1
:clean_end