summaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
authorOtto Kekäläinen <otto@mariadb.org>2016-11-25 00:10:15 +0100
committerOtto Kekäläinen <otto@mariadb.org>2016-11-25 08:50:57 +0100
commit89236a8ad93bbfa39b935afc8eabdaab5a1e2474 (patch)
tree67a3ef30cd2c64030fb1a2e90402e49c59111d85 /debian
parente726ae6b045ec1b11553ea5e150c9751f1e270d9 (diff)
downloadmariadb-git-89236a8ad93bbfa39b935afc8eabdaab5a1e2474.tar.gz
Deb: skip invoke-rc.d mysql stop if no mysql process is running at all
Quite often in upgrades on systemd systems dpkg emitted an error like: Failed to stop mysql.service: Unit mysql.service not loaded. invoke-rc.d: initscript mysql, action "stop" failed. invoke-rc.d returned 5 There is a MySQL server running, but we failed in our attempts to stop it. Stop it yourself and try again! dpkg: error processing archive /var/cache/apt/archives/mariadb-server-10.2 This is because the mariadb/mysql.service file is not loaded during the upgrade/unpack stage of dpkg in certain situations. With this simple check we can easily skip the shutdown step when it is really not needed, which is for sure the case if no mysqld process at all is running on the entire system.
Diffstat (limited to 'debian')
-rw-r--r--debian/mariadb-server-10.2.preinst4
1 files changed, 4 insertions, 0 deletions
diff --git a/debian/mariadb-server-10.2.preinst b/debian/mariadb-server-10.2.preinst
index 9804b1ccd6e..9c37cba7a9c 100644
--- a/debian/mariadb-server-10.2.preinst
+++ b/debian/mariadb-server-10.2.preinst
@@ -23,6 +23,10 @@ mysql_upgradedir=/var/lib/mysql-upgrade
stop_server() {
if [ ! -x /etc/init.d/mysql ]; then return; fi
+ # Return immediately if there are no mysql processes running
+ # as there is no point in trying to shutdown in that case.
+ if ! pgrep mysqld > /dev/null; then return; fi
+
set +e
if [ -x /usr/sbin/invoke-rc.d ]; then
cmd="invoke-rc.d mysql stop"