| 1 | #!/bin/sh |
| 2 | # |
| 3 | # /etc/rc.d/mysqld: start/stop mysqld daemon |
| 4 | # |
| 5 | |
| 6 | MYSQL_CFG=/etc/my.cnf |
| 7 | |
| 8 | MYSQL_PID=`sed -n 's/^pid-file[ \t]*=[ \t]*//p' $MYSQL_CFG` |
| 9 | MYSQL_USR=`sed -n 's/^user[ \t]*=[ \t]*//p' $MYSQL_CFG` |
| 10 | |
| 11 | case $1 in |
| 12 | start) |
| 13 | touch $MYSQL_PID |
| 14 | chown $MYSQL_USR $MYSQL_PID |
| 15 | /usr/sbin/mysqld & |
| 16 | ;; |
| 17 | stop) |
| 18 | killall -q /usr/sbin/mysqld |
| 19 | rm $MYSQL_PID |
| 20 | ;; |
| 21 | restart) |
| 22 | $0 stop |
| 23 | sleep 2 |
| 24 | $0 start |
| 25 | ;; |
| 26 | *) |
| 27 | echo "usage: $0 [start|stop|restart]" |
| 28 | ;; |
| 29 | esac |
| 30 | |
| 31 | # End of file |