From 4696835c6557c2eae3be6a292144493be9d98f67 Mon Sep 17 00:00:00 2001 From: Blake Matthes Date: Wed, 19 Mar 2025 17:14:33 -0500 Subject: [PATCH] feat(installer): added a check for lstv2 already installed --- server/scripts/update.ps1 | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/server/scripts/update.ps1 b/server/scripts/update.ps1 index 0160c6e..dc68889 100644 --- a/server/scripts/update.ps1 +++ b/server/scripts/update.ps1 @@ -172,21 +172,28 @@ $plantFunness = { Write-Host "Removing services that are no longer used." & $nssmPath remove "LogisticsSupportTool" confirm & $nssmPath remove $serviceAuth confirm + # & $nssmPath remove $serviceGateway confirm + # if($token -eq "usday1"){ + # & $nssmPath remove $serviceOcme confirm + # } Start-Sleep -Seconds 5 - ## adding in lstAdm - Write-Host "Adding $($serviceLstV2)... incase its missing." - $commandToRun = "run start" - $description = "logistics Support Tool" - & $nssmPath install $serviceLstV2 $npmPath $commandToRun - Write-Host "Setting the app directory" - & $nssmPath set $serviceLstV2 AppDirectory $appPath - Write-Host "Setting the description" - & $nssmPath set $serviceLstV2 Description $description - Write-Host "Setting recovery options" - # Set recovery options - sc.exe failure $serviceLstV2 reset= 0 actions= restart/5000/restart/5000/restart/5000 + $service = Get-Service -Name $serviceLstV2 -ErrorAction SilentlyContinue + if(-not $service){ + ## adding in lstAdm + Write-Host "Adding $($serviceLstV2)... incase its missing." + $commandToRun = "run start" + $description = "logistics Support Tool" + & $nssmPath install $serviceLstV2 $npmPath $commandToRun + Write-Host "Setting the app directory" + & $nssmPath set $serviceLstV2 AppDirectory $appPath + Write-Host "Setting the description" + & $nssmPath set $serviceLstV2 Description $description + Write-Host "Setting recovery options" + # Set recovery options + sc.exe failure $serviceLstV2 reset= 0 actions= restart/5000/restart/5000/restart/5000 + } # Doing an install Write-Host "Running the install to make sure everything is updated." Set-Location $serverPath @@ -235,10 +242,9 @@ $plantFunness = { Start-Service -DisplayName $serviceLstV2 Start-Sleep -Seconds 1 Write-Host "$($server) finished updating" - if($token -eq "usday1"){ Write-Host "Starting $($serviceOcme)" - Start-Service -DisplayName $serviceOcme + Start-Service -DisplayName $serviceOcme } }