mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
44 lines
1 KiB
PowerShell
44 lines
1 KiB
PowerShell
<#
|
|
.SYNOPSIS
|
|
Stops a timer object started with Start-IcingaTimer for a specific
|
|
named timer
|
|
.DESCRIPTION
|
|
Stops a timer object started with Start-IcingaTimer for a specific
|
|
named timer
|
|
.FUNCTIONALITY
|
|
Stops a timer object started with Start-IcingaTimer for a specific
|
|
named timer
|
|
.EXAMPLE
|
|
PS>Stop-IcingaTimer;
|
|
.EXAMPLE
|
|
PS>Stop-IcingaTimer -Name 'My Test Timer';
|
|
.PARAMETER Name
|
|
The name of a custom identifier to run mutliple timers at once
|
|
.INPUTS
|
|
System.String
|
|
.LINK
|
|
https://github.com/Icinga/icinga-powershell-framework
|
|
#>
|
|
|
|
function Stop-IcingaTimer()
|
|
{
|
|
param (
|
|
[string]$Name = 'DefaultTimer'
|
|
);
|
|
|
|
$TimerObject = Get-IcingaTimer -Name $Name;
|
|
|
|
if ($null -eq $TimerObject) {
|
|
return;
|
|
}
|
|
|
|
if ($TimerObject.IsRunning) {
|
|
$TimerObject.Stop();
|
|
}
|
|
Add-IcingaHashtableItem -Key $Name -Value (
|
|
@{
|
|
'Active' = $FALSE;
|
|
'Timer' = $TimerObject;
|
|
}
|
|
) -Hashtable $Global:Icinga.Private.Timers -Override | Out-Null;
|
|
}
|