-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·31 lines (25 loc) · 911 Bytes
/
run.sh
File metadata and controls
executable file
·31 lines (25 loc) · 911 Bytes
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
#!/bin/bash
# Check if Java is installed
if ! command -v java &> /dev/null; then
echo "Java is not installed. Please install Java 17 or higher."
exit 1
fi
# Check Java version
java_version=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}')
echo "Java version: $java_version"
# Check if Maven is installed
if ! command -v mvn &> /dev/null; then
echo "Maven is not installed. Please install Maven 3.6 or higher."
exit 1
fi
# Check if PostgreSQL is running
if ! pg_isready -h localhost -p 5432 &> /dev/null; then
echo "PostgreSQL is not running. Please start PostgreSQL."
exit 1
fi
# Create database if it doesn't exist
echo "Creating database if it doesn't exist..."
psql -h localhost -p 5432 -c "CREATE DATABASE testit_reports;" 2>/dev/null || echo "Database already exists."
# Build and run the application
echo "Building and running the application..."
mvn spring-boot:run