wok-next diff mariadb/stuff/etc/init.d/mysql @ rev 13054

Add: mariadb
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Wed Jun 20 15:35:34 2012 +0200 (2012-06-20)
parents
children 0d8a1a3edc72
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/mariadb/stuff/etc/init.d/mysql	Wed Jun 20 15:35:34 2012 +0200
     1.3 @@ -0,0 +1,70 @@
     1.4 +#!/bin/sh
     1.5 +# /etc/init.d/mysql : Start, stop and restart MySQL server on SliTaz, at 
     1.6 +# boot time or with the command line.
     1.7 +#
     1.8 +# To start MySQL server at boot time, just put mysql in the $RUN_DAEMONS
     1.9 +# variable of /etc/rcS.conf and configure options with /etc/daemons.conf
    1.10 +#
    1.11 +. /etc/init.d/rc.functions
    1.12 +. /etc/daemons.conf
    1.13 +
    1.14 +NAME=Mysql
    1.15 +DESC="MySQL server"
    1.16 +DAEMON=/usr/bin/mysqld_safe
    1.17 +OPTIONS=$MYSQL_OPTIONS
    1.18 +PIDFILE=/var/run/mysqld/mysql.pid
    1.19 +[ -n "$OPTIONS" ] || OPTIONS="--pid-file=$PIDFILE --datadir=/var/lib/mysql --user=mysql --socket=/var/run/mysqld/mysqld.sock"
    1.20 +
    1.21 +case "$1" in
    1.22 +  start)
    1.23 +    if active_pidfile $PIDFILE mysqld ; then
    1.24 +      echo "$NAME already running."
    1.25 +      exit 1
    1.26 +    fi
    1.27 +    if [ ! -d /var/lib/mysql/mysql ]; then
    1.28 +      echo "Initializing $DESC: "
    1.29 +      rm -rf /var/lib/mysql/* 2> /dev/null
    1.30 +      mysql_install_db --user=mysql --datadir=/var/lib/mysql
    1.31 +    fi
    1.32 +    echo -n "Starting $DESC: $NAME... "
    1.33 +    $DAEMON $OPTIONS  > /dev/null &
    1.34 +    status
    1.35 +    sleep 2
    1.36 +    for i in /etc/mysql.d/* ; do
    1.37 +    	[ -x $i ] || continue
    1.38 +	echo -n "Running $i..."
    1.39 +	$i
    1.40 +	status
    1.41 +    done
    1.42 +    ;;
    1.43 +  stop)
    1.44 +    if ! active_pidfile $PIDFILE mysqld ; then
    1.45 +      echo "$NAME is not running."
    1.46 +      exit 1
    1.47 +    fi
    1.48 +    echo -n "Stopping $DESC: $NAME... "
    1.49 +    kill `cat $PIDFILE`> /dev/null
    1.50 +    status
    1.51 +    sleep 2
    1.52 +    ;;
    1.53 +  restart)
    1.54 +    if ! active_pidfile $PIDFILE mysqld ; then
    1.55 +      echo "$NAME is not running."
    1.56 +      exit 1
    1.57 +    fi
    1.58 +    echo -n "Restarting $DESC: $NAME... "
    1.59 +    kill `cat $PIDFILE`
    1.60 +    sleep 2
    1.61 +    $DAEMON $OPTIONS &
    1.62 +    status
    1.63 +    sleep 2
    1.64 +    ;;
    1.65 +  *)
    1.66 +    echo ""
    1.67 +    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
    1.68 +    echo ""
    1.69 +    exit 1
    1.70 +    ;;
    1.71 +esac
    1.72 +
    1.73 +exit 0