mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
The stdout and stderr are useful logs when debugging and trying to figure out why plugin output is causing backend to stop and exception. This commit enables output redirection to `/app/stdout.log` and `/app/stderr.log` from the backend. This may need backporting to production as it appears the fields are unused in the backend. Additionally, when searching logs in the UI, the old logs appear first and your search results will invariably find old information when searching with ctrl-f-"string"-enter. So upon backend start and to keep them relevant, the stdout, stderr, and app logs are cleared.
25 lines
724 B
Bash
Executable File
25 lines
724 B
Bash
Executable File
#!/bin/sh
|
|
# Start (or restart) the NetAlertX Python backend under debugpy in background.
|
|
# This script is invoked by the VS Code task "Restart GraphQL".
|
|
# It exists to avoid complex inline command chains that were being mangled by the task runner.
|
|
|
|
set -e
|
|
|
|
LOG_DIR=/app/log
|
|
APP_DIR=/app/server
|
|
PY=python3
|
|
PORT_DEBUG=5678
|
|
|
|
# Kill any prior debug/run instances
|
|
sudo killall python3 2>/dev/null || true
|
|
sleep 2
|
|
|
|
echo ''|tee -a $LOG_DIR/stdout.log $LOG_DIR/stderr.log $LOG_DIR/app.log
|
|
|
|
cd "$APP_DIR"
|
|
|
|
# Launch using absolute module path for clarity; rely on cwd for local imports
|
|
setsid nohup ${PY} -m debugpy --listen 0.0.0.0:${PORT_DEBUG} /app/server/__main__.py 1>>/app/log/stdout.log 2>>/app/log/stderr.log &
|
|
PID=$!
|
|
sleep 2
|