diff --git a/server/scripts/services.ps1 b/server/scripts/services.ps1 index 045830d..9b33606 100644 --- a/server/scripts/services.ps1 +++ b/server/scripts/services.ps1 @@ -2,8 +2,8 @@ param ( [string]$serviceName, [string]$option, [string]$appPath, - [string]$command, # just the command like run startadm or what ever you have in npm. - [string]$description + [string]$command, # just the command like run start or what ever you have in npm. + [string]$description, [string]$remote ) @@ -11,16 +11,6 @@ param ( # .\services.ps1 -serviceName "LSTV2" -option "install" -appPath "E:\LST\lstV2" -description "Logistics Support Tool V2" -command "run start" -### the fix -# .\services.ps1 -serviceName "LST-App" -option "delete" -appPath "E:\LST\lstV2" -description "Logistics Support Tool V2" -command "run start" -# .\services.ps1 -serviceName "LST-frontend" -option "delete" -appPath "E:\LST\lstV2" -description "Logistics Support Tool V2" -command "run start" -# .\services.ps1 -serviceName "LST-System" -option "delete" -appPath "E:\LST\lstV2" -description "Logistics Support Tool V2" -command "run start" -# .\services.ps1 -serviceName "LST-Gateway" -option "delete" -appPath "E:\LST\lstV2" -description "Logistics Support Tool V2" -command "run start" - -# .\services.ps1 -serviceName "LST-App" -option "install" -appPath "E:\LST\lst_backend" -description "Logistics Support Tool V2" -command "run startapp" -# .\services.ps1 -serviceName "LST-frontend" -option "install" -appPath "E:\LST\lst_backend" -description "Logistics Support Tool V2" -command "run startfront" - - $nssmPath = $AppPath + "\nssm.exe" $npmPath = "C:\Program Files\nodejs\npm.cmd" # Path to npm.cmd @@ -74,6 +64,30 @@ if ($option -eq "delete"){ } +if ($option -eq "prodStop"){ + if(-not $appPath){ + Write-host "The path to the app is missing please add it in and try again." + exit 1 + } + & $nssmPath stop $serviceName + write-host "Removing $($serviceName)" + #& $nssmPath remove $serviceName confirm + sc.exe config $serviceName start= disabled + +} + +if ($option -eq "prodStart"){ + if(-not $appPath){ + Write-host "The path to the app is missing please add it in and try again." + exit 1 + } + & $nssmPath start $serviceName + write-host "Removing $($serviceName)" + #& $nssmPath remove $serviceName confirm + sc.exe config $serviceName start= auto + +} + if($option -eq "install"){ if(-not $appPath -or -not $description -or -not $command){ Write-host "Please check all parameters are passed to install the app.."