harfbuzz: security bump to version 1.4.4
[buildroot-gz.git] / package / mariadb / S97mysqld
blob62357fa8c489bec157a9d75ca57add58f0d517e7
1 #!/bin/sh
3 # mysql
6 MYSQL_LIB="/var/lib/mysql"
7 MYSQL_RUN="/run/mysql"
8 MYSQL_PID="$MYSQL_RUN/mysqld.pid"
9 MYSQL_BIN="/usr/bin"
11 wait_for_ready() {
12 WAIT_DELAY=5
13 while [ $WAIT_DELAY -gt 0 ]; do
14 if $MYSQL_BIN/mysqladmin ping > /dev/null 2>&1; then
15 return 0
17 sleep 1
18 : $((WAIT_DELAY -= 1))
19 done
20 return 1
23 start() {
24 if [ `ls -1 $MYSQL_LIB | wc -l` = 0 ] ; then
25 printf "Creating mysql system tables ... "
26 $MYSQL_BIN/mysql_install_db --basedir=/usr --user=mysql \
27 --datadir=$MYSQL_LIB > /dev/null 2>&1
28 if [ $? != 0 ]; then
29 echo "FAIL"
30 exit 1
32 echo "OK"
35 # mysqld runs as user mysql, but /run is only writable by root
36 # so create a subdirectory for mysql.
37 install -d -o mysql -g root -m 0755 $MYSQL_RUN
39 # We don't use start-stop-daemon because mysqld has its own
40 # wrapper script.
41 printf "Starting mysql ... "
42 $MYSQL_BIN/mysqld_safe --pid-file=$MYSQL_PID --user=mysql \
43 > /dev/null 2>&1 &
44 wait_for_ready
45 [ $? = 0 ] && echo "OK" || echo "FAIL"
48 stop() {
49 printf "Stopping mysql ... "
50 if [ -f $MYSQL_PID ]; then
51 kill `cat $MYSQL_PID` > /dev/null 2>&1
52 [ $? = 0 ] && echo "OK" || echo "FAIL"
53 else
54 echo "FAIL"
58 restart() {
59 stop
60 sleep 1
61 start
64 case "$1" in
65 start)
66 start
68 stop)
69 stop
71 restart)
72 restart
75 echo "Usage: $0 {start|stop|restart}"
77 esac