icinga-powershell-framework/lib/daemon/Get-IcingaForWindowsServicePid.psm1

12 lines
360 B
PowerShell
Raw Normal View History

2022-02-07 09:29:27 -05:00
function Get-IcingaForWindowsServicePid()
{
[string]$PidFile = (Join-Path -Path (Get-IcingaCacheDir) -ChildPath 'service.pid');
[string]$IfWPid = Read-IcingaFileSecure -File $PidFile;
if ([string]::IsNullOrEmpty($IfWPid) -eq $FALSE) {
$IfWPid = $IfWPid.Replace("`r`n", '').Replace("`n", '').Replace(' ', '');
}
return $IfWPid;
}