首次提交:初始化项目代码
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
# CloudNest 本地服务清理脚本
|
||||
# CloudNest Local Services Cleanup Script
|
||||
#
|
||||
# 用法 / Usage: .\stop-local.ps1
|
||||
# 停止所有本地运行的 auth-service、file-service、go 进程
|
||||
|
||||
$ErrorActionPreference = "Continue"
|
||||
|
||||
Write-Host "=== CloudNest 服务清理 ===" -ForegroundColor Cyan
|
||||
|
||||
# 查找端口占用 / Find port usage
|
||||
Write-Host "[信息] 检查端口占用..." -ForegroundColor Yellow
|
||||
$ports = Get-NetTCPConnection -LocalPort 8080,8081,8082 -ErrorAction SilentlyContinue
|
||||
if ($ports) {
|
||||
$ports | Select-Object LocalPort, OwningProcess, State | Format-Table
|
||||
} else {
|
||||
Write-Host " 无端口占用" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# 终止 Go 相关进程 / Kill Go-related processes
|
||||
Write-Host "[信息] 终止服务进程..." -ForegroundColor Yellow
|
||||
$processes = Get-Process | Where-Object {
|
||||
$_.ProcessName -eq "go" -or
|
||||
$_.ProcessName -eq "auth-service" -or
|
||||
$_.ProcessName -eq "file-service"
|
||||
}
|
||||
|
||||
if ($processes) {
|
||||
$processes | Select-Object Id, ProcessName, StartTime | Format-Table
|
||||
foreach ($p in $processes) {
|
||||
Write-Host " 终止进程: $($p.ProcessName) (PID: $($p.Id))" -ForegroundColor DarkGray
|
||||
Stop-Process -Id $p.Id -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
Write-Host "[完成] 服务进程已终止" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host " 无服务进程运行" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# 再次检查端口 / Verify ports are free
|
||||
Write-Host "[验证] 再次检查端口..." -ForegroundColor Yellow
|
||||
$remaining = Get-NetTCPConnection -LocalPort 8080,8081,8082 -ErrorAction SilentlyContinue
|
||||
if ($remaining) {
|
||||
Write-Host "[警告] 仍有端口占用,可能需要手动处理" -ForegroundColor Red
|
||||
$remaining | Select-Object LocalPort, OwningProcess, State | Format-Table
|
||||
} else {
|
||||
Write-Host "[完成] 端口 8080/8081/8082 已释放" -ForegroundColor Green
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "提示: Docker 基础设施容器仍在运行,如需停止请执行:" -ForegroundColor DarkGray
|
||||
Write-Host " docker compose -f docker-compose.infra.yml down" -ForegroundColor DarkGray
|
||||
Reference in New Issue
Block a user