Skip to content

Commit

Permalink
[build] Attempt to stop service pre-install
Browse files Browse the repository at this point in the history
  • Loading branch information
jbudz committed May 27, 2016
1 parent 83c5802 commit 6c6e4d3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions tasks/build/os_packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module.exports = function (grunt) {
'--maintainer', 'Kibana Team\ \<info@elastic.co\>',
'--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',
Expand Down
13 changes: 13 additions & 0 deletions tasks/build/package_scripts/pre_install.sh
Original file line number Diff line number Diff line change
@@ -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
5 changes: 2 additions & 3 deletions tasks/build/package_scripts/pre_remove.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 6c6e4d3

Please sign in to comment.