]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/initscripts/init.d/mysql
Fixed connection tracking bug (also in Core 27).
[people/pmueller/ipfire-2.x.git] / src / initscripts / init.d / mysql
1 #!/bin/sh
2 # Begin $rc_base/init.d/mysql
3
4 # Based on sysklogd script from LFS-3.1 and earlier.
5 # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
6
7 #$LastChangedBy: bdubbs $
8 #$Date: 2005-08-01 14:29:19 -0500 (Mon, 01 Aug 2005) $
9
10 . /etc/sysconfig/rc
11 . $rc_functions
12
13 PIDFILE=/srv/mysql/`/bin/hostname`.pid
14 KILLDELAY=20
15
16 case "$1" in
17 start)
18 boot_mesg -n "Starting MySQL daemon..."
19 failure=0
20 if [ -f "$PIDFILE" ]
21 then
22 if /bin/ps p `cat $PIDFILE` | grep mysqld >/dev/null
23 then
24 boot_mesg "mysqld already running!" ${WARNING}
25 echo_warning
26 exit 0
27 else
28 rm -f "$PIDFILE"
29 if [ -f "$PIDFILE" ]
30 then
31 failure=1
32 fi
33 fi
34 fi
35 if [ "$failure" = "1" ]
36 then
37 echo ""
38 echo_failure
39 else
40 echo ""
41 /usr/bin/mysqld_safe --user=mysql 2>&1 >/dev/null &
42 evaluate_retval
43 fi
44 ;;
45
46 stop)
47 boot_mesg -n "Stopping MySQL daemon..."
48 if [ -e "$PIDFILE" ]
49 then
50 echo ""
51 killproc -p ${PIDFILE} /usr/bin/mysqld_safe
52 else
53 boot_mesg "mysqld not running!" ${WARNING}
54 echo_warning
55 if [ -e "$PIDFILE" ]
56 then
57 rm -f $PIDFILE
58 fi
59 fi
60 ;;
61
62 restart)
63 $0 stop
64 sleep 1
65 $0 start
66 ;;
67
68 status)
69 statusproc /usr/sbin/mysqld
70 ;;
71
72 *)
73 echo "Usage: $0 {start|stop|restart|status}"
74 exit 1
75 ;;
76 esac
77
78 # End $rc_base/init.d/mysql