diff --git a/farmq-install.ps1 b/farmq-install.ps1 index 4143190..de4b351 100644 --- a/farmq-install.ps1 +++ b/farmq-install.ps1 @@ -187,8 +187,14 @@ function Start-TailscaleService { Write-Status "Tailscale 서비스 시작 중..." try { - # Tailscale 서비스 시작 - $service = Get-Service -Name "Tailscale" -ErrorAction SilentlyContinue + # MSI가 "Tailscale" 서비스를 등록한다. 등록까지 몇 초 걸릴 수 있어 폴링한다. + $service = $null + for ($i = 0; $i -lt 15; $i++) { + $service = Get-Service -Name "Tailscale" -ErrorAction SilentlyContinue + if ($service) { break } + Start-Sleep -Seconds 2 + } + if ($service) { if ($service.Status -ne "Running") { Start-Service -Name "Tailscale" @@ -196,7 +202,19 @@ function Start-TailscaleService { } Write-Success "Tailscale 서비스가 실행 중입니다." } else { + # 서비스가 없으면 tailscaled 로 직접 서비스 설치 시도 Write-Warning "Tailscale 서비스를 찾을 수 없습니다. 수동 시작을 시도합니다." + $tailscaled = "C:\Program Files\Tailscale\tailscaled.exe" + if (Test-Path $tailscaled) { + Start-Process -FilePath $tailscaled -ArgumentList "install" -Wait -ErrorAction SilentlyContinue + Start-Sleep -Seconds 3 + $service = Get-Service -Name "Tailscale" -ErrorAction SilentlyContinue + if ($service -and $service.Status -ne "Running") { + Start-Service -Name "Tailscale" -ErrorAction SilentlyContinue + Start-Sleep -Seconds 3 + } + if ($service) { Write-Success "Tailscale 서비스가 실행 중입니다." } + } } } catch {