From f329f504040f3608478c687a99aa36a3cf5720b7 Mon Sep 17 00:00:00 2001
From: xyc <jc_xiong@hotmail.com>
Date: 星期六, 03 十月 2026 23:45:04 +0800
Subject: [PATCH] feat(observation): 新增观测站分日调查数据导入与明细查看

---
 deploy-templates/backend/start-backend-service.cmd |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/deploy-templates/backend/start-backend-service.cmd b/deploy-templates/backend/start-backend-service.cmd
new file mode 100644
index 0000000..e3e8c16
--- /dev/null
+++ b/deploy-templates/backend/start-backend-service.cmd
@@ -0,0 +1,49 @@
+@echo off
+rem ============================================================
+rem  Non-interactive launcher for Task Scheduler / boot auto-start.
+rem  Differences from start-backend.cmd (which is meant for a human):
+rem    - no "pause" at the end (nobody can press a key during boot)
+rem    - all output goes to app.log next to this file
+rem    - resolves java via JAVA_HOME first, then PATH
+rem    - exits 0 immediately if port 8090 is already listening
+rem  ASCII-only on purpose: cmd.exe reads this file with the OEM
+rem  code page, so non-ASCII text here would be garbled.
+rem  Registered by install-autostart.ps1; run under the account that
+rem  owns the deployment folder (SYSTEM by default).
+rem ============================================================
+setlocal
+cd /d "%~dp0"
+
+set "APP_JAR=traffic-audit-server-1.0.0-SNAPSHOT.jar"
+set "LOG=%~dp0app.log"
+
+netstat -ano | findstr /C:":8090" | findstr /I "LISTENING" >nul 2>nul
+if not errorlevel 1 (
+  echo [%date% %time%] port 8090 is already listening; nothing to do. >> "%LOG%"
+  exit /b 0
+)
+
+if not exist "%~dp0%APP_JAR%" (
+  echo [%date% %time%] ERROR: %APP_JAR% not found in "%CD%". >> "%LOG%"
+  exit /b 1
+)
+
+set "JAVA_EXE="
+if defined JAVA_HOME if exist "%JAVA_HOME%\bin\java.exe" set "JAVA_EXE=%JAVA_HOME%\bin\java.exe"
+if not defined JAVA_EXE for %%J in (java.exe) do set "JAVA_EXE=%%~$PATH:J"
+if not defined JAVA_EXE (
+  echo [%date% %time%] ERROR: java.exe not found. Install JDK 8 or set JAVA_HOME / PATH. >> "%LOG%"
+  exit /b 1
+)
+
+if not exist "%~dp0application.yml" (
+  echo [%date% %time%] WARN: application.yml is missing next to the jar. >> "%LOG%"
+  echo [%date% %time%]       The DB password placeholder will resolve to empty and startup will fail with >> "%LOG%"
+  echo [%date% %time%]       "Access denied ... (using password: NO)". >> "%LOG%"
+)
+
+echo [%date% %time%] starting backend: "%JAVA_EXE%" -jar "%APP_JAR%"  (cwd "%CD%") >> "%LOG%"
+"%JAVA_EXE%" -jar "%~dp0%APP_JAR%" >> "%LOG%" 2>&1
+set "RC=%ERRORLEVEL%"
+echo [%date% %time%] backend exited with code %RC%. >> "%LOG%"
+endlocal & exit /b %RC%

--
Gitblit v1.9.1