|
|
|
|
@ -95,6 +95,9 @@ Function Nssm-Install
|
|
|
|
|
{
|
|
|
|
|
Throw "Error installing service ""$name"". No application was supplied."
|
|
|
|
|
}
|
|
|
|
|
If (-Not (Test-Path -Path $application -PathType Leaf)) {
|
|
|
|
|
Throw "$application does not exist on the host"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!(Service-Exists -name $name))
|
|
|
|
|
{
|
|
|
|
|
@ -138,6 +141,21 @@ Function Nssm-Install
|
|
|
|
|
$result.changed = $true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($result.changed)
|
|
|
|
|
{
|
|
|
|
|
$applicationPath = (Get-Item $application).DirectoryName
|
|
|
|
|
$cmd = "nssm set ""$name"" AppDirectory $applicationPath"
|
|
|
|
|
|
|
|
|
|
$results = invoke-expression $cmd
|
|
|
|
|
|
|
|
|
|
if ($LastExitCode -ne 0)
|
|
|
|
|
{
|
|
|
|
|
Set-Attr $result "nssm_error_cmd" $cmd
|
|
|
|
|
Set-Attr $result "nssm_error_log" "$results"
|
|
|
|
|
Throw "Error installing service ""$name"""
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Function ParseAppParameters()
|
|
|
|
|
|