83 lines
2.5 KiB
Plaintext
83 lines
2.5 KiB
Plaintext
|
#!/bin/sh
|
||
|
|
||
|
#----------------------------------------------------------------------
|
||
|
# copyright (C) 2022 Koozali Foundation
|
||
|
#
|
||
|
# This program is free software; you can redistribute it and/or modify
|
||
|
# it under the terms of the GNU General Public License as published by
|
||
|
# the Free Software Foundation; either version 2 of the License, or
|
||
|
# (at your option) any later version.
|
||
|
#
|
||
|
# This program is distributed in the hope that it will be useful,
|
||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
# GNU General Public License for more details.
|
||
|
#
|
||
|
# You should have received a copy of the GNU General Public License
|
||
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||
|
#
|
||
|
# Technical support for this program is available from Mitel Networks
|
||
|
# Please visit our web site www.mitel.com/sme/ for details.
|
||
|
#----------------------------------------------------------------------
|
||
|
|
||
|
# We have to re-enable SCL environment, because /sbin/service
|
||
|
# clears almost all environment variables.
|
||
|
# Since X_SCLS is cleared as well, we lose information about other
|
||
|
# collections enabled.
|
||
|
. /opt/rh/rh-mariadb!!!VER!!!/service-environment
|
||
|
for sclname in $RH_MARIADB!!!VER!!!_SCLS_ENABLED ; do
|
||
|
. /opt/rh/$sclname/enable
|
||
|
export X_SCLS="$X_SCLS $sclname"
|
||
|
done
|
||
|
|
||
|
# we want start daemon only inside "scl enable" invocation
|
||
|
if ! scl_enabled $sclname ; then
|
||
|
echo "Collection $sclname has to be listed in /opt/rh/rh-mariadb!!!VER!!!/service-environment"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
|
||
|
# Source function library.
|
||
|
. /etc/rc.d/init.d/functions
|
||
|
|
||
|
if [ $# -lt 1 ]; then
|
||
|
echo "Usage: $0 <start|restart>" 1>&2
|
||
|
exit 1
|
||
|
fi
|
||
|
# We should only do something if $1 is 'start'.
|
||
|
if [ $1 != "start" ] && [ $1 != "restart" ]; then
|
||
|
exit 0
|
||
|
fi
|
||
|
|
||
|
for i in $(seq 1 10)
|
||
|
do
|
||
|
if test -e !!!SOCKET!!!
|
||
|
then
|
||
|
exit_value=0
|
||
|
HOME=/root
|
||
|
export HOME
|
||
|
for link in $(find /etc/e-smith/sql/init!!!VER!!! -type f -o -type l | sort)
|
||
|
do
|
||
|
F=$(basename $link | sed s/S[0-9][0-9]//)
|
||
|
case $F in
|
||
|
*.sql)
|
||
|
action "Loading $F into mariadb !!!VER!!!" /opt/rh/rh-mariadb!!!VER!!!/root/usr/bin/mysql --socket=!!!SOCKET!!! < $link && /bin/rm $link
|
||
|
;;
|
||
|
*)
|
||
|
action "Loading $F into mariadb !!!VER!!!" $link && /bin/rm $link
|
||
|
;;
|
||
|
esac
|
||
|
# Record any failure for the final return value.
|
||
|
if [ $? -ne 0 ]; then
|
||
|
exit_value=1
|
||
|
fi
|
||
|
done
|
||
|
exit $exit_value
|
||
|
fi
|
||
|
echo "Waiting for mysql to startup" >&2
|
||
|
sleep 2
|
||
|
done
|
||
|
|
||
|
exit 1
|