diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index eab9aada674..00a472dfd95 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -61,6 +61,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff] - Eliminate cloning of event in deepUpdate {pull}35945[35945] - Fix ndjson parser to store JSON fields correctly under `target` {issue}29395[29395] - Support build of projects outside of beats directory {pull}36126[36126] +- After upgrade the deb package now restarts the Beat service {issue}34089[34089] {pull}36201[36201] diff --git a/dev-tools/packaging/files/linux/systemd-daemon-reload.sh b/dev-tools/packaging/files/linux/systemd-daemon-reload.sh deleted file mode 100644 index 65589fb789c..00000000000 --- a/dev-tools/packaging/files/linux/systemd-daemon-reload.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -systemctl daemon-reload 2> /dev/null -exit 0 diff --git a/dev-tools/packaging/packages.yml b/dev-tools/packaging/packages.yml index 52ca5d42ad4..5d49f0f8bee 100644 --- a/dev-tools/packaging/packages.yml +++ b/dev-tools/packaging/packages.yml @@ -19,7 +19,7 @@ shared: # Deb/RPM spec for community beats. - &deb_rpm_spec <<: *common - post_install_script: '{{ elastic_beats_dir }}/dev-tools/packaging/files/linux/systemd-daemon-reload.sh' + post_install_script: '{{ elastic_beats_dir }}/dev-tools/packaging/templates/deb/postinstall.sh.tmpl' files: /usr/share/{{.BeatName}}/bin/{{.BeatName}}{{.BinaryExt}}: source: build/golang-crossbuild/{{.BeatName}}-{{.GOOS}}-{{.Platform.Arch}}{{.BinaryExt}} @@ -618,4 +618,4 @@ specs: '{{.BeatName}}{{.BinaryExt}}': source: data/{{.BeatName}}-{{ commit_short }}/{{.BeatName}}{{.BinaryExt}} symlink: true - mode: 0755 \ No newline at end of file + mode: 0755 diff --git a/dev-tools/packaging/templates/deb/postinstall.sh.tmpl b/dev-tools/packaging/templates/deb/postinstall.sh.tmpl new file mode 100644 index 00000000000..eda0b16b9ad --- /dev/null +++ b/dev-tools/packaging/templates/deb/postinstall.sh.tmpl @@ -0,0 +1,6 @@ +#!/usr/bin/sh + +systemctl daemon-reload 2> /dev/null +systemctl is-active {{.BeatName}} --quiet && systemctl restart {{.BeatName}} +exit 0 +