From 6c6e4d31ffebf2b7889b850506052ace715216ee Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Mon, 9 May 2016 14:40:05 -0500 Subject: [PATCH] [build] Attempt to stop service pre-install --- tasks/build/os_packages.js | 1 + tasks/build/package_scripts/pre_install.sh | 13 +++++++++++++ tasks/build/package_scripts/pre_remove.sh | 5 ++--- 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 tasks/build/package_scripts/pre_install.sh diff --git a/tasks/build/os_packages.js b/tasks/build/os_packages.js index 0cc52fe69dd49..839782a9e3e55 100644 --- a/tasks/build/os_packages.js +++ b/tasks/build/os_packages.js @@ -29,6 +29,7 @@ module.exports = function (grunt) { '--maintainer', 'Kibana Team\ \', '--license', 'Apache\ 2.0', '--after-install', resolve(packageScriptsDir, 'post_install.sh'), + '--before-install', resolve(packageScriptsDir, 'pre_install.sh'), '--before-remove', resolve(packageScriptsDir, 'pre_remove.sh'), '--after-remove', resolve(packageScriptsDir, 'post_remove.sh'), '--config-files', '/opt/kibana/config/kibana.yml', diff --git a/tasks/build/package_scripts/pre_install.sh b/tasks/build/package_scripts/pre_install.sh new file mode 100644 index 0000000000000..4762a74db219d --- /dev/null +++ b/tasks/build/package_scripts/pre_install.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +if command -v systemctl >/dev/null && systemctl is-active kibana.service >/dev/null; then + systemctl --no-reload stop kibana.service +elif [ -x /etc/init.d/kibana ]; then + if command -v invoke-rc.d >/dev/null; then + invoke-rc.d kibana stop + elif command -v service >/dev/null; then + service kibana stop + else + /etc/init.d/kibana stop + fi +fi diff --git a/tasks/build/package_scripts/pre_remove.sh b/tasks/build/package_scripts/pre_remove.sh index b279efa5e6577..745c782af40b5 100644 --- a/tasks/build/package_scripts/pre_remove.sh +++ b/tasks/build/package_scripts/pre_remove.sh @@ -1,10 +1,9 @@ #!/bin/sh echo -n "Stopping kibana service..." -if command -v systemctl >/dev/null; then +if command -v systemctl >/dev/null && systemctl is-active kibana.service >/dev/null; then systemctl --no-reload stop kibana.service -fi -if [ -x /etc/init.d/kibana ]; then +elif [ -x /etc/init.d/kibana ]; then if command -v invoke-rc.d >/dev/null; then invoke-rc.d kibana stop elif command -v service >/dev/null; then