From 96e337e120c58950a71ab2f38c8c61f22cdc1a07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Hor=C3=A1k?= Date: Mon, 6 Jan 2014 12:08:06 +0100 Subject: [PATCH] Check if socket file is not being used by another process at a time of starting the service Related: #1045435 --- mariadb-prepare-db-dir | 10 ++++++++++ mariadb.spec | 3 +++ 2 files changed, 13 insertions(+) diff --git a/mariadb-prepare-db-dir b/mariadb-prepare-db-dir index 8762ab7..c4c333f 100644 --- a/mariadb-prepare-db-dir +++ b/mariadb-prepare-db-dir @@ -50,6 +50,16 @@ chown "$myuser:$mygroup" "$errlogfile" chmod 0640 "$errlogfile" [ -x /sbin/restorecon ] && /sbin/restorecon "$errlogfile" +# We check if there is already a process using the socket file, +# since otherwise this systemd service file could report false +# positive result when starting and mysqld_safe could remove +# a socket file, which actually uses a different daemon. +if fuser "$socketfile" &>/dev/null ; then + echo "Socket file $socketfile exists." >&2 + echo "Is another MySQL daemon already running with the same unix socket?" >&2 + exit 1 +fi + # Make the data directory if [ ! -d "$datadir/mysql" ] ; then # First, make sure $datadir is there with correct permissions diff --git a/mariadb.spec b/mariadb.spec index 774d429..d9ac190 100644 --- a/mariadb.spec +++ b/mariadb.spec @@ -801,6 +801,9 @@ fi Related: #1044565 - Use upstream's layout for symbols version in client library Related: #1045013 +- Check if socket file is not being used by another process at a time + of starting the service + Related: #1045435 * Wed Nov 27 2013 Honza Horak 1:5.5.34-2 - Fix mariadb-wait-ready script