Commit | Line | Data |
---|---|---|
d2ab2f68 VM |
1 | #!/bin/sh |
2 | # | |
3 | # /etc/rc.d/mysqld: start/stop mysqld daemon | |
4 | # | |
5 | ||
6 | SSD=/sbin/start-stop-daemon | |
7 | PROG=/usr/sbin/mysqld | |
8 | MYSQL_CFG=/etc/my.cnf | |
9 | NAME=mysqld | |
10 | PID=/var/run/mysql/mysqld.pid | |
11 | LOG=/var/log/mysqld.log | |
12 | OPTS="--pid-file=$PID" | |
13 | ||
14 | case $1 in | |
15 | start) | |
16 | $SSD --start -bC --pidfile $PID --exec $PROG -- $OPTS >> $LOG 2>&1 | |
17 | ;; | |
18 | stop) | |
19 | $SSD --stop --remove-pidfile --retry 10 --name=$NAME --pidfile $PID | |
20 | ;; | |
21 | restart) | |
22 | $0 stop | |
23 | $0 start | |
24 | ;; | |
25 | status) | |
26 | $SSD --status --name=$NAME --pidfile $PID | |
27 | case $? in | |
28 | 0) echo "$PROG is running with pid $(cat $PID)" ;; | |
29 | 1) echo "$PROG is not running but the pid file $PID exists" ;; | |
30 | 3) echo "$PROG is not running" ;; | |
31 | 4) echo "Unable to determine the program status" ;; | |
32 | esac | |
33 | ;; | |
34 | *) | |
35 | echo "usage: $0 [start|stop|restart|status]" | |
36 | ;; | |
37 | esac | |
38 | ||
39 | # End of file |