From f2056aa95043fd5eb5cae26feab103f8e8c455a8 Mon Sep 17 00:00:00 2001 From: Honza Horak Date: Mon, 5 May 2014 12:36:12 +0200 Subject: [PATCH] Script for socket check enhanced --- mariadb-check-socket | 29 ++++++++++++++++++++++++++--- mariadb.spec | 5 ++++- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/mariadb-check-socket b/mariadb-check-socket index 90e835b..955dc4f 100644 --- a/mariadb-check-socket +++ b/mariadb-check-socket @@ -7,10 +7,33 @@ source "`dirname ${BASH_SOURCE[0]}`/mariadb-scripts-common" -if fuser "$socketfile" &>/dev/null ; then +if test -e "$socketfile" ; then echo "Socket file $socketfile exists." >&2 - echo "Is another MySQL daemon running with the same unix socket?" >&2 - exit 1 + + # no write permissions + if ! test -w "$socketfile" ; then + echo "Not enough permission to write to the socket file $socketfile, which is suspicious." >&2 + echo "Please, remove $socketfile manually to start the service." >&2 + exit 1 + fi + + # not a socket file + if ! test -S "$socketfile" ; then + echo "The file $socketfile is not a socket file, which is suspicious." >&2 + echo "Please, remove $socketfile manually to start the service." >&2 + exit 1 + fi + + # some process uses the socket file + if fuser "$socketfile" &>/dev/null ; then + socketpid=$(fuser "$socketfile" 2>/dev/null) + echo "Is another MySQL daemon already running with the same unix socket?" >&2 + echo "Please, stop the process $socketpid or remove $socketfile manually to start the service." >&2 + exit 1 + fi + + # socket file is a garbage + echo "No process is using $socketfile, which means it is a garbage, so it will be removed automatically." >&2 fi exit 0 diff --git a/mariadb.spec b/mariadb.spec index bf9f34a..0ea764a 100644 --- a/mariadb.spec +++ b/mariadb.spec @@ -7,7 +7,7 @@ Name: mariadb Version: 10.0.10 -Release: 2%{?dist} +Release: 3%{?dist} Epoch: 1 Summary: A community developed branch of MySQL @@ -807,6 +807,9 @@ fi %{_mandir}/man1/mysql_client_test.1* %changelog +* Mon May 05 2014 Honza Horak - 1:10.0.10-3 +- Script for socket check enhanced + * Thu Apr 10 2014 Jakub Dorňák - 1:10.0.10-2 - use system pcre library