From 2134d509c2e69c93f2a8c5105d3ed12d349d099d Mon Sep 17 00:00:00 2001 From: Andrew Kroh Date: Tue, 29 Aug 2017 10:10:59 -0400 Subject: [PATCH] Improvements to beatname.sh Use `exec` with the command to start the beat so that it replaces the shell process leaving only the beat process. This is nicer because you don't have the "beatname.sh" process showing up in `ps` output. Change the hashbang to `#!/usr/bin/env bash` instead of `#!/bin/bash`. This is generally more portable. --- CHANGELOG.asciidoc | 2 ++ dev-tools/packer/platforms/centos/beatname.sh.j2 | 4 ++-- dev-tools/packer/platforms/debian/beatname.sh.j2 | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 51db444da79..9219cc47444 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -58,6 +58,8 @@ https://github.com/elastic/beats/compare/v6.0.0-beta2...master[Check the HEAD di *Affecting all Beats* - Move TCP UDP start up into `server.Start()` {pull}4903[4903] +- Changed the hashbang used in the beat helper script from `/bin/bash` to `/usr/bin/env bash`. {pull}5051[5051] +- Changed beat helper script to use `exec` when running the beat. {pull}5051[5051] *Auditbeat* diff --git a/dev-tools/packer/platforms/centos/beatname.sh.j2 b/dev-tools/packer/platforms/centos/beatname.sh.j2 index 9bb9c23da63..2601507722c 100644 --- a/dev-tools/packer/platforms/centos/beatname.sh.j2 +++ b/dev-tools/packer/platforms/centos/beatname.sh.j2 @@ -1,9 +1,9 @@ -#!/bin/bash +#!/usr/bin/env bash # Script to run {.beat_name} in foreground with the same path settings that # the init script / systemd unit file would do. -/usr/share/{{.beat_name}}/bin/{{.beat_name}} \ +exec /usr/share/{{.beat_name}}/bin/{{.beat_name}} \ -path.home /usr/share/{{.beat_name}} \ -path.config /etc/{{.beat_name}} \ -path.data /var/lib/{{.beat_name}} \ diff --git a/dev-tools/packer/platforms/debian/beatname.sh.j2 b/dev-tools/packer/platforms/debian/beatname.sh.j2 index e37b7df26f1..fc36a268b83 100644 --- a/dev-tools/packer/platforms/debian/beatname.sh.j2 +++ b/dev-tools/packer/platforms/debian/beatname.sh.j2 @@ -1,9 +1,9 @@ -#!/bin/bash +#!/usr/bin/env bash # Script to run {{.beat_name}} in foreground with the same path settings that # the init script / systemd unit file would do. -/usr/share/{{.beat_name}}/bin/{{.beat_name}} \ +exec /usr/share/{{.beat_name}}/bin/{{.beat_name}} \ -path.home /usr/share/{{.beat_name}} \ -path.config /etc/{{.beat_name}} \ -path.data /var/lib/{{.beat_name}} \