Created
July 16, 2017 14:39
-
-
Save JAW-Dev/d5f8ec74b01dddb63013ac3f9ca2600e to your computer and use it in GitHub Desktop.
Bash script for strating and stopping Valet and MySQL
This file contains 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/sh | |
# Check if a service is running. | |
function running() { | |
if ps ax | grep -v grep | grep "$1" &> /dev/null; then | |
return 0 | |
else | |
return 1 | |
fi; | |
} | |
if running "nginx" && ! running "mysqld"; then | |
brew services start mysql | |
elif ! running "nginx" && running "mysqld"; then | |
valet start | |
elif ! running "nginx" && ! running "mysqld"; then | |
valet start | |
brew services start mysql | |
else running "nginx" && running "mysqld"; | |
valet stop | |
brew services stop mysql | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment