diff --git a/mariadb-prepare-db-dir b/mariadb-prepare-db-dir index 8265747..3b464e9 100644 --- a/mariadb-prepare-db-dir +++ b/mariadb-prepare-db-dir @@ -29,6 +29,20 @@ fi # Set up the errlogfile with appropriate permissions touch "$errlogfile" +ret=$? +# Provide some advice if the log file cannot be touched +if [ $ret -ne 0 ] ; then + errlogdir=$(dirname $errlogfile) + if ! [ -d "$errlogdir" ] ; then + echo "The directory $errlogdir does not exist." + elif [ -f "$errlogfile" ] ; then + echo "The log file $errlogfile cannot be touched, please, fix its permissions." + else + echo "The log file $errlogfile could not be created." + fi + echo "The daemon will be run under $myuser:$mygroup" + exit 1 +fi chown "$myuser:$mygroup" "$errlogfile" chmod 0640 "$errlogfile" [ -x /sbin/restorecon ] && /sbin/restorecon "$errlogfile" diff --git a/mariadb-scripts-common b/mariadb-scripts-common index e1f7b21..02b53a7 100755 --- a/mariadb-scripts-common +++ b/mariadb-scripts-common @@ -43,7 +43,9 @@ datadir="$result" # if there is log_error in the my.cnf, my_print_defaults still # returns log-error -get_mysql_option mysqld_safe log-error "`hostname`.err" +# log-error might be defined in mysqld_safe and mysqld sections, +# the former has bigger priority +get_mysql_option "mysqld_safe mysqld" log-error "`hostname`.err" errlogfile="$result" get_mysql_option mysqld socket "/var/lib/mysql/mysql.sock" diff --git a/mariadb.spec b/mariadb.spec index eb5be49..f38aa62 100644 --- a/mariadb.spec +++ b/mariadb.spec @@ -840,6 +840,7 @@ fi - Multilib support re-worked - Introduce new option with_mysqld_unit - Removed obsolete mysql-cluster, the package should already be removed +- Improve error message when log file is not writable * Wed Jun 18 2014 Mikko Tiihonen - 1:10.0.12-2 - Use -fno-delete-null-pointer-checks to avoid segfaults with gcc 4.9