wok-stable view mysql/stuff/etc/init.d/mysql @ rev 1140

Add mysql
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Jul 24 13:32:43 2008 +0000 (2008-07-24)
parents
children 42f40e9e6a2f
line source
1 #!/bin/sh
2 # /etc/init.d/mysql : Start, stop and restart MySQL server on SliTaz, at
3 # boot time or with the command line.
4 #
5 # To start MySQL server at boot time, just put mysql in the $RUN_DAEMONS
6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf
7 #
8 . /etc/init.d/rc.functions
9 . /etc/daemons.conf
11 NAME=Mysql
12 DESC="MySQL server"
13 DAEMON=/usr/bin/mysqld_safe
14 OPTIONS=$MYSQL_OPTIONS
15 PIDFILE=/var/run/mysqld/mysql.pid
16 [ -n "$OPTIONS" ] || OPTIONS="--pid-file=$PIDFILE --datadir=/var/lib/mysql --user=mysql --socket=/var/run/mysqld/mysqld.sock"
18 case "$1" in
19 start)
20 if [ -f $PIDFILE ] ; then
21 echo "$NAME already running."
22 exit 1
23 fi
24 echo -n "Starting $DESC: $NAME... "
25 $DAEMON $OPTIONS &
26 status
27 sleep 2
28 ;;
29 stop)
30 if [ ! -f $PIDFILE ] ; then
31 echo "$NAME is not running."
32 exit 1
33 fi
34 echo -n "Stopping $DESC: $NAME... "
35 kill `cat $PIDFILE`
36 status
37 sleep 2
38 ;;
39 restart)
40 if [ ! -f $PIDFILE ] ; then
41 echo "$NAME is not running."
42 exit 1
43 fi
44 echo -n "Restarting $DESC: $NAME... "
45 kill `cat $PIDFILE`
46 sleep 2
47 $DAEMON $OPTIONS &
48 status
49 sleep 2
50 ;;
51 *)
52 echo ""
53 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
54 echo ""
55 exit 1
56 ;;
57 esac
59 exit 0