Script for socket check enhanced

This commit is contained in:
Honza Horak 2014-05-05 12:36:12 +02:00
parent 78d8add8e5
commit f2056aa950
2 changed files with 30 additions and 4 deletions

View File

@ -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

View File

@ -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 <hhorak@redhat.com> - 1:10.0.10-3
- Script for socket check enhanced
* Thu Apr 10 2014 Jakub Dorňák <jdornak@redhat.com> - 1:10.0.10-2
- use system pcre library