From d13fbf9a17735f02102d772d435475676fe48c96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Grzegorz=20Kokosi=C5=84ski?= Date: Wed, 25 Jul 2018 10:03:51 +0200 Subject: [PATCH] Check if Presto is running before erasing RPM According to: http://refspecs.linuxbase.org/LSB_3.0.0/LSB-PDA/LSB-PDA/iniscrptact.html when service is correctly stopped it returns 3. --- presto-server-rpm/pom.xml | 1 + presto-server-rpm/src/main/rpm/preremove | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 presto-server-rpm/src/main/rpm/preremove diff --git a/presto-server-rpm/pom.xml b/presto-server-rpm/pom.xml index be6be69c954ff..4c7faccc07939 100644 --- a/presto-server-rpm/pom.xml +++ b/presto-server-rpm/pom.xml @@ -83,6 +83,7 @@ x86_64 src/main/rpm/preinstall src/main/rpm/postinstall + src/main/rpm/preremove src/main/rpm/postremove diff --git a/presto-server-rpm/src/main/rpm/preremove b/presto-server-rpm/src/main/rpm/preremove new file mode 100644 index 0000000000000..319d2af06a257 --- /dev/null +++ b/presto-server-rpm/src/main/rpm/preremove @@ -0,0 +1,5 @@ +/etc/init.d/presto status > /dev/null 2>&1 +if [[ $? != 3 ]]; then + echo "Please stop the Presto service before erasing RPM" + exit 1 +fi