File tree Expand file tree Collapse file tree 1 file changed +12
-17
lines changed Expand file tree Collapse file tree 1 file changed +12
-17
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
- SSL_DIR=" ssl"
4
- KEY_FILE=" $SSL_DIR /key.pem"
5
- CERT_FILE=" $SSL_DIR /cert.pem"
6
-
7
- if [[ ! -f " .venv/bin/activate" ]]; then
8
- echo " ❌ Python virtual environment not found. Please run build.sh first."
9
- exit 1
3
+ PID=$( ps aux | grep ' uvicorn app.main:app' | grep -v grep | awk ' {print $2}' )
4
+ if [ -z " $PID " ]; then
5
+ echo " No uvicorn process found running app.main:app."
6
+ exit 0
10
7
fi
11
8
12
- if [[ ! -f " $KEY_FILE " || ! -f " $CERT_FILE " ]]; then
13
- echo " ❌ SSL certificate or key missing. Please run build.sh first."
14
- exit 1
9
+ echo " Stopping uvicorn process (PID $PID )..."
10
+ kill " $PID "
11
+ sleep 2
12
+ if ps -p $PID > /dev/null; then
13
+ echo " uvicorn (PID $PID ) did not stop, sending SIGKILL."
14
+ kill -9 " $PID "
15
+ else
16
+ echo " uvicorn stopped."
15
17
fi
16
-
17
- echo " 🔑 Activating virtual environment..."
18
- # shellcheck source=/dev/null
19
- source .venv/bin/activate
20
-
21
- echo " 🚦 Starting uvicorn server with HTTPS (https://localhost:8000)"
22
- uvicorn app.main:app --host 0.0.0.0 --port 8000 --ssl-keyfile " $KEY_FILE " --ssl-certfile " $CERT_FILE "
You can’t perform that action at this time.
0 commit comments