summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Bychko <alexey.bychko@mariadb.com>2021-03-26 18:01:10 +0700
committerAlexey Bychko <alexey.bychko@mariadb.com>2021-03-29 12:19:57 +0700
commitc0ca3c4ffa45042d608e55326036443e8c4f600d (patch)
tree1905b2faffbdca2c994408726e6f4f0783a70585
parent2fc76a50229ab29f6524dc08d21ab52b750b2918 (diff)
downloadmariadb-git-c0ca3c4ffa45042d608e55326036443e8c4f600d.tar.gz
MDEV-25240 minor upgrade does not perform server restartbb-10.2-MDEV-25240
we need to stop server instance on upgrade, but it may be started either by SysV init script or by SystemD. this commit adds `mysql` target to `systemctl stop` call. `mysql` may be the name of initscript or an alias while `mariadb` is a systemd unit file.
-rw-r--r--support-files/rpm/server-posttrans.sh11
1 files changed, 8 insertions, 3 deletions
diff --git a/support-files/rpm/server-posttrans.sh b/support-files/rpm/server-posttrans.sh
index 1406c78a5f5..1525b592735 100644
--- a/support-files/rpm/server-posttrans.sh
+++ b/support-files/rpm/server-posttrans.sh
@@ -1,10 +1,15 @@
if [ -r %{restart_flag} ] ; then
rm %{restart_flag}
+ # only restart the server if it was alredy running
if [ -x /usr/bin/systemctl ] ; then
/usr/bin/systemctl daemon-reload > /dev/null 2>&1
- /usr/bin/systemctl try-restart mariadb.service > /dev/null 2>&1
+ if [ /usr/bin/systemctl is-active mysql ]; then
+ /usr/bin/systemctl restart mysql > /dev/null 2>&1
+ else
+ /usr/bin/systemctl try-restart mariadb.service > /dev/null 2>&1
+ fi
+ # not a systemd-enabled environment, use SysV startup script
elif %{_sysconfdir}/init.d/mysql status > /dev/null 2>&1; then
- # only restart the server if it was alredy running
- %{_sysconfdir}/init.d/mysql restart
+ %{_sysconfdir}/init.d/mysql restart > /dev/null 2>&1
fi
fi