-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds feature to offload service and JEA actions to scheduled tasks
- Loading branch information
1 parent
f028ade
commit 3029bca
Showing
16 changed files
with
262 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
param ( | ||
[string]$ServiceName = '', | ||
[string]$TmpFilePath = '' | ||
); | ||
|
||
Use-Icinga -Minimal; | ||
|
||
[bool]$Success = $TRUE; | ||
[string]$ErrMsg = ""; | ||
|
||
try { | ||
Restart-Service "$ServiceName" -ErrorAction Stop; | ||
} catch { | ||
$Success = $FALSE; | ||
$ErrMsg = [string]::Format('Failed to restart service "{0}": {1}', $ServiceName, $_.Exception.Message); | ||
} | ||
|
||
Write-IcingaFileSecure -File "$TmpFilePath" -Value ( | ||
@{ | ||
'Success' = $Success; | ||
'Message' = [string]::Format('Service "{0}" successfully restarted', $ServiceName); | ||
'ErrMsg' = $ErrMsg; | ||
} | ConvertTo-Json -Depth 100 | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
param ( | ||
[string]$ServiceName = '', | ||
[string]$TmpFilePath = '' | ||
); | ||
|
||
Use-Icinga -Minimal; | ||
|
||
[bool]$Success = $TRUE; | ||
[string]$ErrMsg = ""; | ||
|
||
try { | ||
Start-Service "$ServiceName" -ErrorAction Stop; | ||
} catch { | ||
$Success = $FALSE; | ||
$ErrMsg = [string]::Format('Failed to start service "{0}": {1}', $ServiceName, $_.Exception.Message); | ||
} | ||
|
||
Write-IcingaFileSecure -File "$TmpFilePath" -Value ( | ||
@{ | ||
'Success' = $Success; | ||
'Message' = [string]::Format('Service "{0}" successfully started', $ServiceName); | ||
'ErrMsg' = $ErrMsg; | ||
} | ConvertTo-Json -Depth 100 | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
param ( | ||
[string]$ServiceName = '', | ||
[string]$TmpFilePath = '' | ||
); | ||
|
||
Use-Icinga -Minimal; | ||
|
||
[bool]$Success = $TRUE; | ||
[string]$ErrMsg = ""; | ||
|
||
try { | ||
Stop-Service "$ServiceName" -ErrorAction Stop; | ||
} catch { | ||
$Success = $FALSE; | ||
$ErrMsg = [string]::Format('Failed to stop service "{0}": {1}', $ServiceName, $_.Exception.Message); | ||
} | ||
|
||
Write-IcingaFileSecure -File "$TmpFilePath" -Value ( | ||
@{ | ||
'Success' = $Success; | ||
'Message' = [string]::Format('Service "{0}" successfully stopped', $ServiceName); | ||
'ErrMsg' = $ErrMsg; | ||
} | ConvertTo-Json -Depth 100 | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.