source: bootscripts-standard/bootscripts/cblfs/init.d/mysql@ 2167cfe

Last change on this file since 2167cfe was 2167cfe, checked in by William Harrington <kb0iic@…>, 11 years ago

bootscripts are the scripts used for the sysvinit book.

  • Property mode set to 100644
File size: 1.3 KB
Line 
1#!/bin/bash
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
13PIDFILE=/srv/mysql/`/bin/hostname`.pid
14KILLDELAY=20
15
16case "$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 >/dev/null 2>&1 &
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 ;;
76esac
77
78# End $rc_base/init.d/mysql
Note: See TracBrowser for help on using the repository browser.