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 committed by Michal Schorm
parent a218b6af28
commit 9be454122e
3 changed files with 12 additions and 9 deletions

View File

@ -1625,6 +1625,9 @@ fi
- Support MYSQLD_OPTS and _WSREP_NEW_CLUSTER env vars in init script, - Support MYSQLD_OPTS and _WSREP_NEW_CLUSTER env vars in init script,
same as it is done in case of systemd unit file same as it is done in case of systemd unit file
Related: #1455850 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 * Wed Jan 10 2018 Michal Schorm <mschorm@redhat.com> - 3:10.2.12-1
- Rebase to 10.2.12 - 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 # Provide some advice if the log file cannot be created by this script
errlogdir=$(dirname "$errlogfile") errlogdir=$(dirname "$errlogfile")
if ! [ -d "$errlogdir" ] ; then if ! [ -d "$errlogdir" ] ; then
echo "The directory $errlogdir does not exist." echo "The directory $errlogdir does not exist." >&2
exit 1 exit 1
elif [ -e "$errlogfile" -a ! -w "$errlogfile" ] ; then elif [ -e "$errlogfile" -a ! -w "$errlogfile" ] ; then
echo "The log file $errlogfile cannot be written, please, fix its permissions." echo "The log file $errlogfile cannot be written, please, fix its permissions." >&2
echo "The daemon will be run under $myuser:$mygroup" echo "The daemon will be run under $myuser:$mygroup" >&2
exit 1 exit 1
fi fi
fi fi
@ -90,14 +90,14 @@ if should_initialize "$datadir" ; then
[ -x /sbin/restorecon ] && /sbin/restorecon "$datadir" [ -x /sbin/restorecon ] && /sbin/restorecon "$datadir"
# Now create the database # 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 # Avoiding deletion of files not created by mysql_install_db is
# guarded by time check and sleep should help work-arounded # guarded by time check and sleep should help work-arounded
# potential issues on systems with 1 second resolution timestamps # potential issues on systems with 1 second resolution timestamps
# https://bugzilla.redhat.com/show_bug.cgi?id=1335849#c19 # https://bugzilla.redhat.com/show_bug.cgi?id=1335849#c19
INITDB_TIMESTAMP=`LANG=C date -u` INITDB_TIMESTAMP=`LANG=C date -u`
sleep 1 sleep 1
@bindir@/mysql_install_db --rpm --datadir="$datadir" --user="$myuser" @bindir@/mysql_install_db --rpm --datadir="$datadir" --user="$myuser" >&2
ret=$? ret=$?
if [ $ret -ne 0 ] ; then if [ $ret -ne 0 ] ; then
echo "Initialization of @NICE_PROJECT_NAME@ database failed." >&2 echo "Initialization of @NICE_PROJECT_NAME@ database failed." >&2
@ -128,8 +128,8 @@ else
else else
# if the directory is not empty but mysql/ directory is missing, then # if the directory is not empty but mysql/ directory is missing, then
# print error and let user to initialize manually or empty the directory # 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 "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`." echo "Make sure the $datadir is empty before running `basename $0`." >&2
exit 1 exit 1
fi fi
fi fi

View File

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