Last active
December 8, 2021 21:43
-
-
Save bandogora/75ef6027977cd2a248facb39e617df82 to your computer and use it in GitHub Desktop.
WSL2: Add to bashrc to check if MySQL server is running and start it if it's not.
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 | |
# Start mysql if its not running | |
mysql_daemon='mysqld' | |
pgrep='/usr/bin/pgrep' | |
$pgrep $mysql_daemon > /dev/null | |
if [ $? -ne 0 ]; then | |
sudo /usr/sbin/service mysql start | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment