-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_invoke_ai_web.sh
More file actions
executable file
·51 lines (38 loc) · 1.21 KB
/
run_invoke_ai_web.sh
File metadata and controls
executable file
·51 lines (38 loc) · 1.21 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
set +x
set -e
LOG_FILE=$HOME/logs
# Array to store PIDs of background processes
PIDS=()
# Function to cleanup child processes
cleanup() {
echo "Received signal, cleaning up child processes..."
for pid in "${PIDS[@]}"; do
echo "Killing process $pid"
kill "$pid" 2>/dev/null || true
done
# Wait a moment for graceful shutdown
sleep 2
exit 0
}
# Set up signal traps to forward signals to child processes
trap cleanup SIGTERM SIGINT SIGQUIT
echo "Running web interface for InvokeAI in ${INVOKE_AI_DIR}"
nohup invokeai-web --root "${INVOKE_AI_DIR}" >>"${LOG_FILE}" 2>&1 &
INVOKE_PID=$!
PIDS+=("$INVOKE_PID")
echo "Started InvokeAI web interface with PID: $INVOKE_PID"
echo "Running Civitai Model Loader on port ${CIVIT_MODEL_LOADER_PORT:=8081}"
python3 -m venv $HOME/venv
. $HOME/venv/bin/activate
pip3 install -r /civit_model_loader/requirements.txt
pushd /civit_model_loader
nohup python3 main.py --port ${CIVIT_MODEL_LOADER_PORT} >>"${LOG_FILE}" 2>&1 &
CIVIT_PID=$!
PIDS+=("$CIVIT_PID")
echo "Started Civitai Model Loader with PID: $CIVIT_PID"
popd
deactivate
echo "All services started. PIDs: ${PIDS[*]}"
echo "Use Ctrl+C to stop all services gracefully"
tail -f "${LOG_FILE}"