auto-save 2026-05-15 11:29 (+1, ~3)

This commit is contained in:
2026-05-15 11:29:23 +08:00
parent e6b2768482
commit 55a9a9d936
5 changed files with 83 additions and 26 deletions

View File

@@ -6,6 +6,10 @@ API_DIR="$ROOT_DIR/api"
WEB_DIR="$ROOT_DIR/web"
LOG_DIR="$ROOT_DIR/.logs"
PID_DIR="$ROOT_DIR/.pids"
LAUNCHD_DIR="$ROOT_DIR/scripts/launchd"
LAUNCHD_DOMAIN="gui/$(id -u)"
API_LABEL="com.skg.tk-recreate.api.dev"
WEB_LABEL="com.skg.tk-recreate.web.dev"
mkdir -p "$LOG_DIR" "$PID_DIR"
@@ -23,12 +27,9 @@ start_api() {
echo "missing api/.venv/bin/uvicorn" >&2
exit 1
fi
(
cd "$API_DIR"
nohup .venv/bin/uvicorn main:app --host 127.0.0.1 --port 4291 >> "$LOG_DIR/api.log" 2>&1 &
echo $! > "$PID_DIR/api.pid"
)
echo "api started on 4291, log: $LOG_DIR/api.log"
launchctl bootout "$LAUNCHD_DOMAIN" "$API_LABEL" >/dev/null 2>&1 || true
launchctl bootstrap "$LAUNCHD_DOMAIN" "$LAUNCHD_DIR/$API_LABEL.plist"
echo "api started on 4291 via launchd, log: $LOG_DIR/api.launchd.log"
}
start_web() {
@@ -40,12 +41,9 @@ start_web() {
echo "missing pnpm in PATH" >&2
exit 1
fi
(
cd "$WEB_DIR"
nohup pnpm dev >> "$LOG_DIR/web.log" 2>&1 &
echo $! > "$PID_DIR/web.pid"
)
echo "web started on 4290, log: $LOG_DIR/web.log"
launchctl bootout "$LAUNCHD_DOMAIN" "$WEB_LABEL" >/dev/null 2>&1 || true
launchctl bootstrap "$LAUNCHD_DOMAIN" "$LAUNCHD_DIR/$WEB_LABEL.plist"
echo "web started on 4290 via launchd, log: $LOG_DIR/web.launchd.log"
}
start_api