diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2015-09-28 15:08:09 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2015-10-12 17:51:49 +0200 |
commit | 6346d1de2fdaa8a8359082871eac49402cb0e472 (patch) | |
tree | 62a057a2b8ab0b24bc242461522017e333fe741f /support-files/rpm | |
parent | 20c2ae39db3dd0ec4c337a9b0bd2bf4481b61e49 (diff) | |
download | mariadb-git-6346d1de2fdaa8a8359082871eac49402cb0e472.tar.gz |
MDEV-427/MDEV-5713 Add systemd script with notify functionality
After review/QA fixes.
Diffstat (limited to 'support-files/rpm')
-rw-r--r-- | support-files/rpm/server-postin.sh | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/support-files/rpm/server-postin.sh b/support-files/rpm/server-postin.sh index 253350512ae..5b95b751212 100644 --- a/support-files/rpm/server-postin.sh +++ b/support-files/rpm/server-postin.sh @@ -1,12 +1,20 @@ - -# Make MySQL start/shutdown automatically when the machine does it. -if [ $1 = 1 ] ; then +if [ -f /usr/lib/systemd/system/mariadb.service -a -x /usr/bin/systemctl ]; then systemd_conf=/etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf - if [ -x /usr/bin/mariadb-service-convert -a ! -f "${systemd_conf}" ]; then - mkdir -p /etc/systemd/system/mariadb.service.d - /usr/bin/mariadb-service-convert > "${systemd_conf}" + if [ -x %{_bindir}/mariadb-service-convert -a ! -f "${systemd_conf}" ]; then + # Either fresh install or upgrade non-systemd -> systemd + mkdir -p /etc/systemd/system/mariadb.service.d + %{_bindir}/mariadb-service-convert > "${systemd_conf}" + # Make sure old possibly non-systemd instance is down + if [ $1 = 2 ]; then + SYSTEMCTL_SKIP_REDIRECT=1 %{_sysconfdir}/init.d/mysql stop >/dev/null 2>&1 || : + systemctl start mariadb >/dev/null 2>&1 || : + fi + systemctl enable mariadb.service >/dev/null 2>&1 || : fi +fi +# Make MySQL start/shutdown automatically when the machine does it. +if [ $1 = 1 ] ; then if [ -x /usr/bin/systemctl ] ; then /usr/bin/systemctl daemon-reload >/dev/null 2>&1 fi |