Last active
July 13, 2018 19:27
-
-
Save ihor/3823371 to your computer and use it in GitHub Desktop.
/etc/init.d/mysql script for Homebrew installed MySQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DAEMON=/usr/local/bin/mysqld_safe | |
OPTS=--defaults-file=/usr/local/etc/mysql/my.cnf | |
NAME=mysql | |
DESC=mysql | |
test -x $DAEMON || exit 0 | |
set -e | |
start() | |
{ | |
$DAEMON $OPTS > /var/log/mysql/output.log 2>&1 & | |
return | |
} | |
stop() | |
{ | |
kill `cat /usr/local/var/run/mysqld/mysqld.pid` | |
return | |
} | |
case "$1" in | |
start) | |
echo -n "Starting $DESC: " | |
start | |
echo "started." | |
;; | |
stop) | |
echo -n "Stopping $DESC: " | |
stop | |
echo "stopped." | |
;; | |
restart|force-reload) | |
echo -n "Restarting $DESC: " | |
stop | |
sleep 1 | |
start | |
echo "restarted." | |
;; | |
*) | |
echo "Usage: $0 {start|stop|restart|force-reload}" >&2 | |
exit 1 | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment