This is a MySQL start up script. I created this script when I faced issues in Ubuntu 10.04 LTS MySQL start up script.
This is a very handy small script which can be used not only for MySQL but for almost all services.
#! /bin/bash
JOB=/usr/sbin/mysqld
case $1 in
start)
$JOB &> /dev/null &
ps aux | grep mysqld | grep -v grep | awk '{print $2}' > /tmp/mysqld.pid
;;
stop)
kill -9 $(cat /tmp/mysqld.pid)
rm -f /tmp/mysqld.pid
;;
restart)
stop
start
;;
*)
echo Oops! bad options
;;
esac
exit 0
0 comments:
Post a Comment