-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.sh
More file actions
27 lines (22 loc) · 897 Bytes
/
app.sh
File metadata and controls
27 lines (22 loc) · 897 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
#!/bin/bash
# SPDX-FileCopyrightText: 2023 Karl Bauer (BAUER GROUP)
# SPDX-License-Identifier: MIT
# Get the directory of the current script
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Install all Requirements on Start of the Image, if required (RUN TIME)
if [ -f "$DIR/requirements.txt" ] && [ ! -f "$DIR/.python-packages-ready" ]; then
echo "Installing Python Requirements..."
pip install --break-system-packages -r "$DIR/requirements.txt"
echo "TO RUN PIP INSTALL FOR REQUIREMENTS.TXT ON NEXT START. DELETE THIS FILE." > "$DIR/.python-packages-ready"
fi
# Check if the application is already running
if pgrep -f main.py > /dev/null
then
echo "The Python Console Application is already running!"
echo "Run stop_app.sh to stop the running process."
else
# Start Application
echo "Starting Python Console Application..."
cd "$DIR"
python3 ./main.py
fi