-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathrun.sh
More file actions
34 lines (27 loc) · 1015 Bytes
/
run.sh
File metadata and controls
34 lines (27 loc) · 1015 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
32
33
34
#!/bin/bash
# Script to run the inference node in production mode with nohup
# This allows the process to continue running after SSH disconnect
# Get the directory where this script is located
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPT_DIR"
# Activate virtual environment
if [ -d "venv" ]; then
source venv/bin/activate
elif [ -d ".venv" ]; then
source .venv/bin/activate
else
echo "Error: Virtual environment not found. Please create one first."
exit 1
fi
# Create logs directory if it doesn't exist
mkdir -p logs
# Run main.py in production mode with nohup
echo "Starting inference node in production mode..."
nohup python main.py --production > logs/nohup.log 2>&1 &
# Get the process ID
PID=$!
echo "Inference node started with PID: $PID"
echo $PID > logs/inference_node.pid
echo "Process is running in the background. Logs are being written to logs/nohup.log"
echo "To stop the process, run: kill $PID"
echo "Or use: kill \$(cat logs/inference_node.pid)"