Improve error message when log file is not writable

This commit is contained in:
Honza Horak 2014-07-18 09:52:36 +02:00
parent 8102b4c264
commit f2af251c7d
3 changed files with 18 additions and 1 deletions

View File

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

View File

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

View File

@ -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 <mikko.tiihonen@iki.fi> - 1:10.0.12-2
- Use -fno-delete-null-pointer-checks to avoid segfaults with gcc 4.9