From f83f458bbf7bfb5dfc201d7f05198d3da99adda3 Mon Sep 17 00:00:00 2001 From: Rob Waight <43173714+rwaight@users.noreply.github.com> Date: Tue, 23 Oct 2018 18:10:23 -0500 Subject: [PATCH 1/5] Set the new service to delayed start Use PowerShell to execute sc config, so we can set the service to delayed start. --- .../packaging/templates/windows/install-service.ps1.tmpl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dev-tools/packaging/templates/windows/install-service.ps1.tmpl b/dev-tools/packaging/templates/windows/install-service.ps1.tmpl index c4b4f682f3c7..d152a130fa26 100644 --- a/dev-tools/packaging/templates/windows/install-service.ps1.tmpl +++ b/dev-tools/packaging/templates/windows/install-service.ps1.tmpl @@ -12,3 +12,10 @@ $workdir = Split-Path $MyInvocation.MyCommand.Path New-Service -name {{.BeatName}} ` -displayName {{.BeatName | title}} ` -binaryPathName "`"$workdir\{{.BeatName}}.exe`" -c `"$workdir\{{.BeatName}}.yml`" -path.home `"$workdir`" -path.data `"C:\ProgramData\{{.BeatName}}`" -path.logs `"C:\ProgramData\{{.BeatName}}\logs`"" + +# Attempt to set the service to delayed start using sc config. +Try { + $svcDelayed='config "{0}" start=delayed-auto' -f '{{.BeatName}}' + Start-Process -FilePath sc.exe -ArgumentList $svcDelayed +} +Catch { Write-Host "An error occured setting the service to delayed start." -ForegroundColor Red } From 97c67b5b627ccab7c02cdfe6ed60aff2c527e967 Mon Sep 17 00:00:00 2001 From: Rob Waight <43173714+rwaight@users.noreply.github.com> Date: Tue, 23 Oct 2018 19:42:19 -0500 Subject: [PATCH 2/5] Make execution of sc config in one command Use PowerShell to execute sc config, so we can set the service to delayed start. --- dev-tools/packaging/templates/windows/install-service.ps1.tmpl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dev-tools/packaging/templates/windows/install-service.ps1.tmpl b/dev-tools/packaging/templates/windows/install-service.ps1.tmpl index d152a130fa26..4aecfc56cb8c 100644 --- a/dev-tools/packaging/templates/windows/install-service.ps1.tmpl +++ b/dev-tools/packaging/templates/windows/install-service.ps1.tmpl @@ -15,7 +15,6 @@ New-Service -name {{.BeatName}} ` # Attempt to set the service to delayed start using sc config. Try { - $svcDelayed='config "{0}" start=delayed-auto' -f '{{.BeatName}}' - Start-Process -FilePath sc.exe -ArgumentList $svcDelayed + Start-Process -FilePath sc.exe -ArgumentList 'config {{.BeatName}} start=delayed-auto' } Catch { Write-Host "An error occured setting the service to delayed start." -ForegroundColor Red } From f22daa0cecd3857fa7223035cb11e05a3dabf399 Mon Sep 17 00:00:00 2001 From: Rob Waight <43173714+rwaight@users.noreply.github.com> Date: Tue, 23 Oct 2018 20:24:50 -0500 Subject: [PATCH 3/5] Update CHANGELOG.asciidoc Entry to the "Added" section under "affecting all beats". --- CHANGELOG.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 5f32931d47e9..48e506c3d933 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -123,6 +123,7 @@ https://github.com/elastic/beats/compare/v6.4.0...master[Check the HEAD diff] - Add Beats Central Management {pull}8559[8559] - Allow Bus to buffer events in case listeners are not configured. {pull}8527[8527] - Enable `host` and `cloud` metadata processors by default. {pull}8596[8596] +- In Windows, set Beats services to automatic-delayed start. {pull}8720[8711] *Auditbeat* From 858d612013d19173facc75c55eba60fb904ac432 Mon Sep 17 00:00:00 2001 From: Rob Waight <43173714+rwaight@users.noreply.github.com> Date: Tue, 23 Oct 2018 20:27:09 -0500 Subject: [PATCH 4/5] Update CHANGELOG.asciidoc --- CHANGELOG.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 48e506c3d933..216b125b17a7 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -123,7 +123,7 @@ https://github.com/elastic/beats/compare/v6.4.0...master[Check the HEAD diff] - Add Beats Central Management {pull}8559[8559] - Allow Bus to buffer events in case listeners are not configured. {pull}8527[8527] - Enable `host` and `cloud` metadata processors by default. {pull}8596[8596] -- In Windows, set Beats services to automatic-delayed start. {pull}8720[8711] +- Set Beats services to automatic-delayed start on Windows. {pull}8720[8711] *Auditbeat* From 6278e6ea995ef7173b69d50999bab4fa54f2daa4 Mon Sep 17 00:00:00 2001 From: Rob Waight <43173714+rwaight@users.noreply.github.com> Date: Tue, 23 Oct 2018 21:00:08 -0500 Subject: [PATCH 5/5] Updated CHANGELOG for pull 8720 Entry to the "Added" section under "affecting all beats". --- CHANGELOG.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 216b125b17a7..07aca9351234 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -123,7 +123,6 @@ https://github.com/elastic/beats/compare/v6.4.0...master[Check the HEAD diff] - Add Beats Central Management {pull}8559[8559] - Allow Bus to buffer events in case listeners are not configured. {pull}8527[8527] - Enable `host` and `cloud` metadata processors by default. {pull}8596[8596] -- Set Beats services to automatic-delayed start on Windows. {pull}8720[8711] *Auditbeat* @@ -302,6 +301,7 @@ The issue will be fixed in the 6.4.1 release. - Add module state reporting for Beats Monitoring. {pull}7075[7075] - Release the `rename` processor as GA. {pull}7656[7656] - Add support for Openstack Nova in `add_cloud_metadata` processor. {pull}7663[7663] +- Add support to set Beats services to automatic-delayed start on Windows. {pull}8720[8711] *Auditbeat*