fixed: 修复203启动exe时,缺少minio启动;启动数据库连接异常问题;
This commit is contained in:
parent
f2323d6be3
commit
bb506fa031
@ -15,14 +15,14 @@ Import-Module ps2exe -ErrorAction Stop
|
||||
$PS1_NAME = "startup"
|
||||
$APPLICATION_NAME = "model"
|
||||
$APPLICATION_VERSION = "1.0.0"
|
||||
$COPY_RIGHT = "© 2025"
|
||||
$COPY_RIGHT = "2025"
|
||||
|
||||
# 基本启动,无 console,可配置开机自启
|
||||
Invoke-PS2EXE -InputFile "${PS1_NAME}.ps1" -OutputFile "${APPLICATION_NAME}.exe" -version "${APPLICATION_VERSION}" -copyright "${COPY_RIGHT}" -requireAdmin -ErrorAction Stop
|
||||
Invoke-PS2EXE -InputFile "${PS1_NAME}.ps1" -OutputFile "${APPLICATION_NAME}.exe" -IconFile "icon.ico" -version "${APPLICATION_VERSION}" -copyright "${COPY_RIGHT}" -requireAdmin -ErrorAction Stop
|
||||
# 基本启动,提供 console,用于 debug
|
||||
Invoke-PS2EXE -InputFile "${PS1_NAME}-console.ps1" -OutputFile "${APPLICATION_NAME}-console.exe" -version "${APPLICATION_VERSION}" -copyright "${COPY_RIGHT}" -requireAdmin -ErrorAction Stop
|
||||
Invoke-PS2EXE -InputFile "${PS1_NAME}-console.ps1" -OutputFile "${APPLICATION_NAME}-console.exe" -IconFile "icon.ico" -version "${APPLICATION_VERSION}" -copyright "${COPY_RIGHT}" -requireAdmin -ErrorAction Stop
|
||||
# 基本启动,两种x
|
||||
Invoke-PS2EXE -InputFile "${PS1_NAME}.ps1" -OutputFile "${APPLICATION_NAME}-x86.exe" -version "${APPLICATION_VERSION}" -copyright "${COPY_RIGHT}" -x86 -requireAdmin -ErrorAction Stop
|
||||
Invoke-PS2EXE -InputFile "${PS1_NAME}.ps1" -OutputFile "${APPLICATION_NAME}-x64.exe" -version "${APPLICATION_VERSION}" -copyright "${COPY_RIGHT}" -x64 -requireAdmin -ErrorAction Stop
|
||||
Invoke-PS2EXE -InputFile "${PS1_NAME}.ps1" -OutputFile "${APPLICATION_NAME}-x86.exe" -IconFile "icon.ico" -version "${APPLICATION_VERSION}" -copyright "${COPY_RIGHT}" -x86 -requireAdmin -ErrorAction Stop
|
||||
Invoke-PS2EXE -InputFile "${PS1_NAME}.ps1" -OutputFile "${APPLICATION_NAME}-x64.exe" -IconFile "icon.ico" -version "${APPLICATION_VERSION}" -copyright "${COPY_RIGHT}" -x64 -requireAdmin -ErrorAction Stop
|
||||
Write-Host "Complete." -ForegroundColor Green
|
||||
Start-Sleep -Seconds 1
|
||||
|
BIN
server/model_full/Execute/win10_203/icon.ico
Normal file
BIN
server/model_full/Execute/win10_203/icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 85 KiB |
@ -24,6 +24,7 @@ $SERVER_NAME = $env:X_MANAGE_DB_SC
|
||||
# Nginx executable name
|
||||
$NGINX_EXE = "model-web.exe"
|
||||
|
||||
$logFile = "debug.log"
|
||||
|
||||
# Log recording function
|
||||
function Write-Log {
|
||||
@ -32,7 +33,7 @@ function Write-Log {
|
||||
)
|
||||
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
|
||||
$logMessage = "[$timestamp] $message"
|
||||
# [debug]
|
||||
# [debug]
|
||||
# Write-Output $logMessage | Out-File -FilePath $logFile -Append
|
||||
Write-Host $logMessage
|
||||
}
|
||||
@ -83,17 +84,17 @@ function Import-Script {
|
||||
$rarName = $rarFile.BaseName
|
||||
$rarDirectoryName = (Get-Item $rarFile.FullName).DirectoryName
|
||||
try {
|
||||
Start-Process -FilePath "rar" -ArgumentList "x -pshzyh!234 `"$($rarFile.FullName)`" `"$rarDirectoryName`"" -NoNewWindow -Wait
|
||||
Start-Process -FilePath "rar" -ArgumentList "x -pshzyh!234 `"$($rarFile.FullName)`" `"$rarDirectoryName`"" -NoNewWindow -Wait
|
||||
|
||||
# Remove rar-file
|
||||
if (Test-Path $rarFile.FullName) {
|
||||
Remove-Item $rarFile.FullName -Force
|
||||
# [debug]
|
||||
# Write-Log "File deleted."
|
||||
} else {
|
||||
# [debug]
|
||||
# Write-Log "File does not exist."
|
||||
}
|
||||
# Remove rar-file
|
||||
if (Test-Path $rarFile.FullName) {
|
||||
Remove-Item $rarFile.FullName -Force
|
||||
# [debug]
|
||||
# Write-Log "File deleted."
|
||||
} else {
|
||||
# [debug]
|
||||
# Write-Log "File does not exist."
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Log "Error unrar $($rarFile.Name):$_"
|
||||
@ -142,24 +143,24 @@ function Import-Script {
|
||||
# Write-Log "Successfully imported $($sqlFile.Name) into database $dbName"
|
||||
Write-Log "Successfully imported $($sqlFile.Name) into database $($folder.Name)"
|
||||
|
||||
$date = $(Get-Date -Format "yyyy-MM-dd")
|
||||
$random = randomText
|
||||
$target = ".\patch\$($date)"
|
||||
New-Item -Path "$target" -ItemType Directory -Force
|
||||
# cmd /c rar a -pPassword -hp "target.rar" "file"
|
||||
# Start-Process -FilePath "rar" -ArgumentList "a -pPassword -hp "target.rar" "file"" -NoNewWindow -Wait
|
||||
# Start-Process -FilePath "rar" -ArgumentList 'a', '-pPassword', '-hpPassword', 'target.rar', 'file' -NoNewWindow -Wait
|
||||
Start-Process -FilePath "rar" -ArgumentList "a -pPassword#20250810! -hp $target\$($random).rar `"$($sqlFile.FullName)`"" -NoNewWindow -Wait
|
||||
$date = $(Get-Date -Format "yyyy-MM-dd")
|
||||
$random = randomText
|
||||
$target = ".\patch\$($date)"
|
||||
New-Item -Path "$target" -ItemType Directory -Force
|
||||
# cmd /c rar a -pPassword -hp "target.rar" "file"
|
||||
# Start-Process -FilePath "rar" -ArgumentList "a -pPassword -hp "target.rar" "file"" -NoNewWindow -Wait
|
||||
# Start-Process -FilePath "rar" -ArgumentList 'a', '-pPassword', '-hpPassword', 'target.rar', 'file' -NoNewWindow -Wait
|
||||
Start-Process -FilePath "rar" -ArgumentList "a -pPassword#$($date)! -hp $target\$($random).rar `"$($sqlFile.FullName)`"" -NoNewWindow -Wait
|
||||
|
||||
# Remove script-file
|
||||
if (Test-Path $sqlFile.FullName) {
|
||||
Remove-Item $sqlFile.FullName -Force
|
||||
# [debug]
|
||||
# Write-Log "File deleted."
|
||||
} else {
|
||||
# [debug]
|
||||
# Write-Log "File does not exist."
|
||||
}
|
||||
# Remove script-file
|
||||
if (Test-Path $sqlFile.FullName) {
|
||||
Remove-Item $sqlFile.FullName -Force
|
||||
# [debug]
|
||||
# Write-Log "File deleted."
|
||||
} else {
|
||||
# [debug]
|
||||
# Write-Log "File does not exist."
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Log "Error importing $($sqlFile.Name):$_"
|
||||
@ -202,26 +203,26 @@ function Append-Utf8NoBomContent {
|
||||
}
|
||||
|
||||
function Go-Home {
|
||||
if($outputWriteHost) {
|
||||
Write-Host ""
|
||||
Write-Host "Exit ..."
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 任务执行完成"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
Start-Sleep -Seconds 5
|
||||
exit 0
|
||||
if($outputWriteHost) {
|
||||
Write-Host ""
|
||||
Write-Host "Exit ..."
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 任务执行完成"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
Start-Sleep -Seconds 5
|
||||
exit 0
|
||||
}
|
||||
|
||||
function Usage-MySQL {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ERROR: Please configure value in the system environment variable."
|
||||
Write-Host "env: - X_MANAGE_DB_EXE"
|
||||
Write-Host " - X_MANAGE_DB_COF"
|
||||
Write-Host "skip database"
|
||||
Write-Host ""
|
||||
}
|
||||
pause
|
||||
Go-Home
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ERROR: Please configure value in the system environment variable."
|
||||
Write-Host "env: - X_MANAGE_DB_EXE"
|
||||
Write-Host " - X_MANAGE_DB_COF"
|
||||
Write-Host "skip database"
|
||||
Write-Host ""
|
||||
}
|
||||
pause
|
||||
Go-Home
|
||||
}
|
||||
|
||||
function Usage-SpringBoot {
|
||||
@ -566,7 +567,12 @@ function Start-SpringBoot {
|
||||
# 指定环境变量 MODEL_MANAGE_DB_SERVER
|
||||
# 指定环境变量 MODEL_MANAGE_DB_PORT
|
||||
# 追加自定义JVM参数 MODEL_VM_PARAMS
|
||||
$arguments = "-Dspring.profiles.active=dev,mysql -Dmybatis-flex.datasource.ds1.password=Wfbke8!LeMY5Fwwe -Dproject.database-ip=$env:MODEL_MANAGE_DB_SERVER -Dproject.database-port=$env:MODEL_MANAGE_DB_PORT $env:MODEL_VM_PARAMS"
|
||||
$arguments = "-Dspring.profiles.active=dev,mysql" +
|
||||
" -Dmybatis-flex.datasource.ds1.username=model" +
|
||||
" -Dmybatis-flex.datasource.ds1.password=Wfbke8!LeMY5Fwwe" +
|
||||
" -Dproject.database-ip=$env:MODEL_MANAGE_DB_SERVER" +
|
||||
" -Dproject.database-port=$env:MODEL_MANAGE_DB_PORT" +
|
||||
" $env:MODEL_VM_PARAMS "
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 启动JVM参数: $arguments"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
|
||||
@ -578,7 +584,8 @@ function Start-SpringBoot {
|
||||
|
||||
# 构建最终的调用命令
|
||||
if($outputWriteHost) {
|
||||
# Write-Host "$($env:JDK_21)\bin\java.exe" $argumentList -jar "$env:MODEL_MANAGE_BIN"
|
||||
# [debug]
|
||||
# Write-Host "$($env:JDK_21)\bin\java.exe" $argumentList -jar "$env:MODEL_MANAGE_BIN"
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 启动完整命令: $($env:JDK_21)\bin\java.exe $argumentList -jar $env:MODEL_MANAGE_BIN"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
@ -596,20 +603,20 @@ Start-Sleep -Seconds 2
|
||||
# 导入数据
|
||||
Import-Script "127.0.0.1" "33306" "root" "Root@2025"
|
||||
|
||||
Start-Sleep -Seconds 1
|
||||
# 检查 Web 运行环境
|
||||
Check-Web
|
||||
# 启动 Nginx 服务
|
||||
Start-Web
|
||||
|
||||
Start-Sleep -Seconds 2
|
||||
# 启动 MinIO 服务
|
||||
Start-MinIO
|
||||
|
||||
Start-Sleep -Seconds 1
|
||||
Start-Sleep -Seconds 2
|
||||
# 检查 SpringBoot 运行环境
|
||||
Check-SpringBoot
|
||||
# 启动 SpringBoot 服务
|
||||
Start-SpringBoot
|
||||
|
||||
Write-Host "已启动模型"
|
||||
Start-Sleep -Seconds 3
|
||||
Start-Sleep -Seconds 6
|
||||
|
@ -517,7 +517,12 @@ function Start-SpringBoot {
|
||||
# 指定环境变量 MODEL_MANAGE_DB_SERVER
|
||||
# 指定环境变量 MODEL_MANAGE_DB_PORT
|
||||
# 追加自定义JVM参数 MODEL_VM_PARAMS
|
||||
$arguments = "-Dspring.profiles.active=dev,mysql -Dmybatis-flex.datasource.ds1.password=Wfbke8!LeMY5Fwwe -Dproject.database-ip=$env:MODEL_MANAGE_DB_SERVER -Dproject.database-port=$env:MODEL_MANAGE_DB_PORT $env:MODEL_VM_PARAMS"
|
||||
$arguments = "-Dspring.profiles.active=dev,mysql" +
|
||||
" -Dmybatis-flex.datasource.ds1.username=model" +
|
||||
" -Dmybatis-flex.datasource.ds1.password=Wfbke8!LeMY5Fwwe" +
|
||||
" -Dproject.database-ip=$env:MODEL_MANAGE_DB_SERVER" +
|
||||
" -Dproject.database-port=$env:MODEL_MANAGE_DB_PORT" +
|
||||
" $env:MODEL_VM_PARAMS "
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 启动JVM参数: $arguments"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
$argumentList = $arguments -split " -"
|
||||
@ -571,4 +576,4 @@ Check-SpringBoot
|
||||
Start-SpringBoot
|
||||
|
||||
Write-Host "已启动模型"
|
||||
Start-Sleep -Seconds 3
|
||||
Start-Sleep -Seconds 5
|
||||
|
Loading…
x
Reference in New Issue
Block a user