slackware-current/source/ap/mariadb/rc.mysqld
Patrick J Volkerding 6e50489fed Fri Apr 23 19:13:09 UTC 2021
a/pkgtools-15.0-noarch-39.txz:  Rebuilt.
  upgradepkg: revert change where $ROOT/sbin/installpkg is called instead of
  /sbin/installpkg. Conceptually, this seemed like a nice change (but would
  have also required removepkg to be called the same way), but it seems to
  break an established expectation that the pkgtools can be used without them
  actually being installed in $ROOT. Thanks to alienBOB.
a/sysvinit-scripts-15.0-noarch-2.txz:  Rebuilt.
  Use #!/bin/bash for these scripts so that bashisms don't cause script issues
  if /bin/sh is some other shell. Thanks to mumahendras3.
  rc.S: Use GazL's proposals for detecting/mounting /proc and /sys.
d/parallel-20210422-noarch-1.txz:  Upgraded.
l/glib-networking-2.68.1-x86_64-1.txz:  Upgraded.
l/gtk+3-3.24.29-x86_64-1.txz:  Upgraded.
x/igt-gpu-tools-1.26-x86_64-1.txz:  Upgraded.
isolinux/initrd.img:  Rebuilt.
  Rebuild with pkgtools-15.0-noarch-39.
usb-and-pxe-installers/usbboot.img:  Rebuilt.
  Rebuild with pkgtools-15.0-noarch-39.
2021-04-24 08:59:55 +02:00

87 lines
2.5 KiB
Bash

#!/bin/sh
# Start/stop/restart mysqld.
#
# Copyright 2003 Patrick J. Volkerding, Concord, CA
# Copyright 2003 Slackware Linux, Inc., Concord, CA
# Copyright 2008, 2013 Patrick J. Volkerding, Sebeka, MN, USA
#
# This program comes with NO WARRANTY, to the extent permitted by law.
# You may redistribute copies of this program under the terms of the
# GNU General Public License.
# To start MariaDB automatically at boot, be sure this script is executable:
# chmod 755 /etc/rc.d/rc.mysqld
# Before you can run MariaDB, you must have a database. To install an initial
# database, do this as root:
#
# mysql_install_db --user=mysql
#
# Note that the mysql user must exist in /etc/passwd, and the created files
# will be owned by this dedicated user. This is important, or else mysql
# (which runs as user "mysql") will not be able to write to the database
# later (this can be fixed with 'chown -R mysql.mysql /var/lib/mysql').
#
# To increase system security, consider using "mysql_secure_installation"
# as well. For more information on this tool, please read:
# man mysql_secure_installation
# To allow outside connections to the database comment out the next line.
# If you don't need incoming network connections, then leave the line
# uncommented to improve system security.
SKIP="--skip-networking"
# Start mysqld:
mysqld_start() {
if [ -x /usr/bin/mysqld_safe ]; then
# If there is an old PID file (no mysqld running), clean it up:
if [ -r /var/run/mysql/mysql.pid ]; then
if ! ps axc | grep mysqld 1> /dev/null 2> /dev/null ; then
echo "Cleaning up old /var/run/mysql/mysql.pid."
rm -f /var/run/mysql/mysql.pid
fi
fi
/usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/run/mysql/mysql.pid $SKIP &
fi
}
# Stop mysqld:
mysqld_stop() {
# If there is no PID file, ignore this request...
if [ -r /var/run/mysql/mysql.pid ]; then
PID=$(cat /var/run/mysql/mysql.pid)
kill $PID
# Wait at least one minute for it to exit, as we don't know how big the DB is...
for second in $(seq 0 60) ; do
if [ ! -r /var/run/mysql/mysql.pid ]; then
break;
fi
sleep 1
done
if [ "$second" = "60" ]; then
echo "WARNING: Gave up waiting for mysqld to exit!"
sleep 15
fi
fi
}
# Restart mysqld:
mysqld_restart() {
mysqld_stop
mysqld_start
}
case "$1" in
'start')
mysqld_start
;;
'stop')
mysqld_stop
;;
'restart')
mysqld_restart
;;
*)
echo "usage $0 start|stop|restart"
esac