From 071a26cc6239189316e15ffc68b999af61e566e4 Mon Sep 17 00:00:00 2001 From: Lord Hepipud Date: Thu, 31 Oct 2019 14:32:19 +0100 Subject: [PATCH] Add smart service interaction functions --- lib/core/framework/Restart-IcingaService.psm1 | 10 ++++++++++ lib/core/framework/Start-IcingaService.psm1 | 10 ++++++++++ lib/core/framework/Stop-IcingaService.psm1 | 10 ++++++++++ 3 files changed, 30 insertions(+) create mode 100644 lib/core/framework/Restart-IcingaService.psm1 create mode 100644 lib/core/framework/Start-IcingaService.psm1 create mode 100644 lib/core/framework/Stop-IcingaService.psm1 diff --git a/lib/core/framework/Restart-IcingaService.psm1 b/lib/core/framework/Restart-IcingaService.psm1 new file mode 100644 index 0000000..ce0f009 --- /dev/null +++ b/lib/core/framework/Restart-IcingaService.psm1 @@ -0,0 +1,10 @@ +function Restart-IcingaService() +{ + param( + $Service + ); + + if (Get-Service $Service -ErrorAction SilentlyContinue) { + Restart-Service $Service; + } +} diff --git a/lib/core/framework/Start-IcingaService.psm1 b/lib/core/framework/Start-IcingaService.psm1 new file mode 100644 index 0000000..ec4b5a7 --- /dev/null +++ b/lib/core/framework/Start-IcingaService.psm1 @@ -0,0 +1,10 @@ +function Start-IcingaService() +{ + param( + $Service + ); + + if (Get-Service $Service -ErrorAction SilentlyContinue) { + Start-Service $Service; + } +} diff --git a/lib/core/framework/Stop-IcingaService.psm1 b/lib/core/framework/Stop-IcingaService.psm1 new file mode 100644 index 0000000..ef91fa8 --- /dev/null +++ b/lib/core/framework/Stop-IcingaService.psm1 @@ -0,0 +1,10 @@ +function Stop-IcingaService() +{ + param( + $Service + ); + + if (Get-Service $Service -ErrorAction SilentlyContinue) { + Stop-Service $Service; + } +}