-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathLaunch Book-Translator.command
More file actions
executable file
·52 lines (42 loc) · 1.15 KB
/
Launch Book-Translator.command
File metadata and controls
executable file
·52 lines (42 loc) · 1.15 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
52
#!/bin/bash
# Get the directory where this script is located
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR"
echo "🚀 Starting Book Translator..."
echo ""
# Kill any existing processes on port 5001
echo "🔪 Killing existing processes on port 5001..."
lsof -ti:5001 | xargs kill -9 2>/dev/null
sleep 1
# Clear cache
echo "🧹 Clearing cache..."
rm -f cache.db translations.db
echo "✓ Cache cleared"
echo ""
# Start the server
echo "🌐 Starting server on http://localhost:5001..."
python3 translator.py &
SERVER_PID=$!
# Wait for server to start
echo "⏳ Waiting for server to start..."
sleep 3
# Check if server is running
if lsof -Pi :5001 -sTCP:LISTEN -t >/dev/null ; then
echo "✓ Server started successfully!"
echo ""
# Open browser
echo "🌍 Opening browser..."
open http://localhost:5001
echo ""
echo "✅ Book Translator is running!"
echo "📝 Server PID: $SERVER_PID"
echo "🌐 URL: http://localhost:5001"
echo ""
echo "Press Ctrl+C to stop the server"
echo ""
# Wait for the server process
wait $SERVER_PID
else
echo "❌ Failed to start server"
exit 1
fi