Skip to content

Commit 2f53844

Browse files
committed
Adds new start and stop Cmdlets for Icinga
1 parent 0b0eafc commit 2f53844

15 files changed

+34
-24
lines changed

doc/100-General/10-Changelog.md

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
1919
### Enhancements
2020

2121
* [#756](https://github.com/Icinga/icinga-powershell-framework/pull/756) Adds feature to set process priority for Icinga for Windows to BelowNormal for improved Host performance
22+
* [#757](https://github.com/Icinga/icinga-powershell-framework/pull/757) Adds new Cmdlets `Start-Icinga`, `Stop-Icinga`, `Start-IcingaForWindows` and `Stop-IcingaForWindows` in addition to the existing Cmdlets `Restart-Icinga` and `Restart-IcingaForWindows`
2223

2324
## 1.13.0 Beta-1 (2024-08-30)
2425

lib/core/framework/Install-IcingaForWindowsService.psm1

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function Install-IcingaForWindowsService()
4646

4747
if ($IfWService.Status -eq 'Running') {
4848
Write-IcingaConsoleNotice 'Stopping Icinga PowerShell service';
49-
Stop-IcingaWindowsService;
49+
Stop-IcingaForWindows;
5050
Start-Sleep -Seconds 1;
5151
}
5252

@@ -93,7 +93,7 @@ function Install-IcingaForWindowsService()
9393
Set-IcingaServiceUser -User 'LocalSystem' -Service 'icingapowershell' | Out-Null;
9494
Restart-IcingaForWindows;
9595
Start-Sleep -Seconds 1;
96-
Stop-IcingaWindowsService;
96+
Stop-IcingaForWindows;
9797
Start-Sleep -Seconds 1;
9898

9999
if ($IfWService.Status -eq 'Running') {

lib/core/framework/Install-IcingaFrameworkUpdate.psm1

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function Install-IcingaFrameworkUpdate()
5757

5858
if ($ServiceStatus -eq 'Running') {
5959
Write-IcingaConsoleNotice 'Stopping Icinga PowerShell service';
60-
Stop-IcingaWindowsService;
60+
Stop-IcingaForWindows;
6161
Start-Sleep -Seconds 1;
6262
}
6363
if ($AgentStatus -eq 'Running') {

lib/core/framework/Invoke-IcingaForWindowsMigration.psm1

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function Invoke-IcingaForWindowsMigration()
1717

1818
Write-IcingaConsoleNotice 'Applying pending migrations required for Icinga for Windows v1.8.0';
1919
if ($ServiceStatus -eq 'Running') {
20-
Stop-IcingaWindowsService;
20+
Stop-IcingaForWindows;
2121
}
2222

2323
$ApiChecks = Get-IcingaPowerShellConfig -Path 'Framework.Experimental.UseApiChecks';
@@ -46,7 +46,7 @@ function Invoke-IcingaForWindowsMigration()
4646
$ServiceStatus = (Get-Service 'icingapowershell' -ErrorAction SilentlyContinue).Status;
4747

4848
if ($ServiceStatus -eq 'Running') {
49-
Stop-IcingaWindowsService;
49+
Stop-IcingaForWindows;
5050
}
5151

5252
# Convert the time intervals for the background daemon services from the previous index handling

lib/core/framework/Uninstall-IcingaForWindowsService.psm1

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function Uninstall-IcingaForWindowsService()
2626

2727
$ServiceData = Get-IcingaForWindowsServiceData;
2828

29-
Stop-IcingaWindowsService;
29+
Stop-IcingaForWindows;
3030
Start-Sleep -Seconds 1;
3131

3232
$ServiceCreation = Start-IcingaProcess -Executable 'sc.exe' -Arguments 'delete icingapowershell';

lib/core/installer/menu/manage/settings/services/ManageServices.psm1

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function Show-IcingaForWindowsMenuManageIcingaForWindowsServices()
8383
'DisabledReason' = 'The Icinga for Windows service is either not installed or not running';
8484
'AdminMenu' = $TRUE;
8585
'Action' = @{
86-
'Command' = 'Stop-IcingaWindowsService';
86+
'Command' = 'Stop-IcingaForWindows';
8787
}
8888
},
8989
@{

lib/core/jea/Deny-IcingaJEACommand.psm1

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function Deny-IcingaJEACommand()
6565
'Restart-IcingaForWindows'.ToLower() {
6666
return $TRUE;
6767
};
68-
'Stop-IcingaWindowsService'.ToLower() {
68+
'Stop-IcingaForWindows'.ToLower() {
6969
return $TRUE;
7070
};
7171
'Stop-IcingaService'.ToLower() {

lib/core/repository/Install-IcingaComponent.psm1

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ function Install-IcingaComponent()
163163

164164
if ($ServiceStatus -eq 'Running') {
165165
Write-IcingaConsoleNotice 'Stopping Icinga for Windows service';
166-
Stop-IcingaWindowsService;
166+
Stop-IcingaForWindows;
167167
Start-Sleep -Seconds 1;
168168
}
169169
if ($AgentStatus -eq 'Running') {

lib/core/windows/Restart-Icinga.psm1

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function Restart-Icinga()
22
{
3-
Restart-IcingaService -Service 'icinga2';
4-
Restart-IcingaForWindows;
3+
Stop-Icinga;
4+
Start-Icinga;
55
}
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
function Restart-IcingaForWindows()
22
{
3-
[string]$JeaPid = Get-IcingaJEAServicePid;
4-
5-
Stop-IcingaService -Service 'icingapowershell';
6-
7-
if ((Test-IcingaJEAServiceRunning -JeaPid $JeaPid)) {
8-
Stop-IcingaJEAProcess -JeaPid $JeaPid;
9-
}
10-
11-
Restart-IcingaService -Service 'icingapowershell';
12-
# Update the process priority after each restart
13-
Start-IcingaWindowsScheduledTaskProcessPriority;
3+
Stop-IcingaForWindows;
4+
Start-IcingaForWindows;
145
}
156

167
Set-Alias -Name 'Restart-IcingaWindowsService' -Value 'Restart-IcingaForWindows';

lib/core/windows/Start-Icinga.psm1

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function Start-Icinga()
2+
{
3+
Start-IcingaService -Service 'icinga2';
4+
Start-IcingaForWindows;
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
function Start-IcingaForWindows()
2+
{
3+
Start-IcingaService -Service 'icingapowershell';
4+
# Update the process priority after each restart
5+
Start-IcingaWindowsScheduledTaskProcessPriority;
6+
}

lib/core/windows/Stop-Icinga.psm1

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function Stop-Icinga()
2+
{
3+
Stop-IcingaService -Service 'icinga2';
4+
Stop-IcingaForWindows;
5+
}

lib/core/windows/Stop-IcingaWindowsService.psm1

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function Stop-IcingaWindowsService()
1+
function Stop-IcingaForWindows()
22
{
33
[string]$JeaPid = Get-IcingaJEAServicePid;
44

@@ -8,3 +8,5 @@ function Stop-IcingaWindowsService()
88
Stop-Process -Id $JeaPid -Force;
99
}
1010
}
11+
12+
Set-Alias -Name 'Stop-IcingaWindowsService' -Value 'Stop-IcingaForWindows';

lib/core/windows/Uninstall-IcingaServiceUser.psm1

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function Uninstall-IcingaServiceUser()
1212
Write-IcingaConsoleNotice 'Uninstalling user "{0}"' -Objects $IcingaUser;
1313

1414
Stop-IcingaService 'icinga2';
15-
Stop-IcingaWindowsService;
15+
Stop-IcingaForWindows;
1616

1717
Set-IcingaPowerShellConfig -Path 'Framework.Icinga.ServiceUser' -Value '';
1818

0 commit comments

Comments
 (0)