network-monitor/native/run.sh
neil 35459b6309 Use the full path for the update command under pct exec
pct exec runs commands with a minimal PATH that lacks /usr/local/bin, so
"pct exec <ctid> -- network-monitor-update" failed with "No such file".
The installer summary, README and CLAUDE.md now give
/usr/local/bin/<name>-update. The in-container summary and the Settings
page no longer suggest sudo where there is none (as root in an LXC).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 19:34:51 -08:00

23 lines
1.3 KiB
Bash
Executable file

#!/usr/bin/env bash
# Starts the app for a native install. systemd (Linux) or launchd (macOS) runs this as the
# service user. It reads .env, keeps the git credentials away from the app, and execs uvicorn.
set -euo pipefail
INSTALL_DIR=$(cd "$(dirname "$0")/.." && pwd)
. "$INSTALL_DIR/native/lib.sh"
. "$INSTALL_DIR/.native"
cd "$INSTALL_DIR"
load_dotenv "$INSTALL_DIR/.env"
unset GIT_TOKEN GIT_USERNAME GIT_SSH_KEY
APP_VERSION=$(git -c safe.directory="$INSTALL_DIR" -C "$INSTALL_DIR" rev-parse --short HEAD 2>/dev/null || echo dev)
PORT=$(app_port)
export ROLE APP_VERSION PORT INSTALL_DIR INSTALL_MODE=native DATA_DIR="$INSTALL_DIR/data" PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1
# How to deploy, as shown on the Settings page. sudo only where it exists (LXCs usually have
# none and you are root there); macOS runs it as the installing user.
UPDATE_COMMAND="$NAME-update"
if [ "$PLATFORM" = systemd ] && command -v sudo >/dev/null 2>&1; then UPDATE_COMMAND="sudo $NAME-update"; fi
if systemd-detect-virt -cq 2>/dev/null; then
UPDATE_COMMAND="$NAME-update (from the Proxmox node: pct exec <ctid> -- /usr/local/bin/$NAME-update)"
fi
export UPDATE_COMMAND
exec "$INSTALL_DIR/.venv/bin/uvicorn" app.main:app --host "$(app_host)" --port "$PORT" \
--no-server-header --timeout-graceful-shutdown 10