Print the same messages as before when starting the service in SysV init, to not scare users

Related: #1463411
This commit is contained in:
Honza Horak 2017-11-07 12:24:46 +01:00
parent a77a3d64a1
commit a6ee91f1b4
3 changed files with 12 additions and 9 deletions

View File

@ -1627,6 +1627,9 @@ fi
- Support MYSQLD_OPTS and _WSREP_NEW_CLUSTER env vars in init script,
same as it is done in case of systemd unit file
Related: #1455850
- Print the same messages as before when starting the service in SysV init,
to not scare users
Related: #1463411
* Wed Jan 10 2018 Michal Schorm <mschorm@redhat.com> - 3:10.2.12-1
- Rebase to 10.2.12

View File

@ -68,11 +68,11 @@ else
# Provide some advice if the log file cannot be created by this script
errlogdir=$(dirname "$errlogfile")
if ! [ -d "$errlogdir" ] ; then
echo "The directory $errlogdir does not exist."
echo "The directory $errlogdir does not exist." >&2
exit 1
elif [ -e "$errlogfile" -a ! -w "$errlogfile" ] ; then
echo "The log file $errlogfile cannot be written, please, fix its permissions."
echo "The daemon will be run under $myuser:$mygroup"
echo "The log file $errlogfile cannot be written, please, fix its permissions." >&2
echo "The daemon will be run under $myuser:$mygroup" >&2
exit 1
fi
fi
@ -90,14 +90,14 @@ if should_initialize "$datadir" ; then
[ -x /sbin/restorecon ] && /sbin/restorecon "$datadir"
# Now create the database
echo "Initializing @NICE_PROJECT_NAME@ database"
echo "Initializing @NICE_PROJECT_NAME@ database" >&2
# Avoiding deletion of files not created by mysql_install_db is
# guarded by time check and sleep should help work-arounded
# potential issues on systems with 1 second resolution timestamps
# https://bugzilla.redhat.com/show_bug.cgi?id=1335849#c19
INITDB_TIMESTAMP=`LANG=C date -u`
sleep 1
@bindir@/mysql_install_db --rpm --datadir="$datadir" --user="$myuser"
@bindir@/mysql_install_db --rpm --datadir="$datadir" --user="$myuser" >&2
ret=$?
if [ $ret -ne 0 ] ; then
echo "Initialization of @NICE_PROJECT_NAME@ database failed." >&2
@ -128,8 +128,8 @@ else
else
# if the directory is not empty but mysql/ directory is missing, then
# print error and let user to initialize manually or empty the directory
echo "Database @NICE_PROJECT_NAME@ is not initialized, but the directory $datadir is not empty, so initialization cannot be done."
echo "Make sure the $datadir is empty before running `basename $0`."
echo "Database @NICE_PROJECT_NAME@ is not initialized, but the directory $datadir is not empty, so initialization cannot be done." >&2
echo "Make sure the $datadir is empty before running `basename $0`." >&2
exit 1
fi
fi

View File

@ -71,8 +71,8 @@ start(){
action $"Starting $prog: " /bin/true
ret=0
else
@libexecdir@/mysql-check-socket || return 1
su - $MYUSER -s /bin/bash -c "@libexecdir@/mysql-prepare-db-dir $MYUSER $MYGROUP" || return 4
@libexecdir@/mysql-check-socket >/dev/null || return 1
su - $MYUSER -s /bin/bash -c "@libexecdir@/mysql-prepare-db-dir $MYUSER $MYGROUP" >/dev/null || return 4
# Pass all the options determined above, to ensure consistent behavior.
# In many cases mysqld_safe would arrive at the same conclusions anyway