-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun-vintly.sh
More file actions
executable file
·51 lines (41 loc) · 1.42 KB
/
Copy pathrun-vintly.sh
File metadata and controls
executable file
·51 lines (41 loc) · 1.42 KB
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
#!/bin/bash
# Vintly Run Script for Mac/Unix
echo "Starting Vintly..."
# Check if we're in a virtual environment
if [ -d ".venv" ]; then
# Try to activate virtual environment
if [ -f ".venv/bin/activate" ]; then
echo "Found virtual environment, activating..."
source .venv/bin/activate
fi
fi
# Start Flask server in the background and capture PID
python3 app.py > .vintly_output.log 2>&1 &
SERVER_PID=$!
echo "Server starting with PID: $SERVER_PID"
# Monitor log file until server is ready
echo "Waiting for server to start..."
while ! grep -q "Running on" .vintly_output.log; do
# Check if process is still running
if ! ps -p $SERVER_PID > /dev/null; then
echo "[ERROR] Server process died. Check .vintly_output.log for details."
exit 1
fi
sleep 0.5
done
# Extract URL from log file
SERVER_URL=$(grep "Running on" .vintly_output.log | head -n 1 | awk '{print $4}' | sed 's/,$//g')
# Open browser
echo "Server is running! Opening browser at $SERVER_URL"
open $SERVER_URL
echo ""
echo "Vintly is running in the background."
echo "The server log is available in .vintly_output.log"
echo ""
echo "Press Ctrl+C to shut down the server when you're done."
# Handle graceful shutdown on Ctrl+C
trap "echo 'Shutting down Vintly...'; kill $SERVER_PID; rm .vintly_output.log; echo 'Vintly has been shut down.'; exit 0" INT
# Keep script running until Ctrl+C
while true; do
sleep 1
done