Last active
January 24, 2019 12:44
-
-
Save Maykonn/fe8c47d0770dd6f1beef38968857a0f6 to your computer and use it in GitHub Desktop.
This gist is a .sh file which test if a service is running, you may change as necessary for your needs
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 | |
local_mysql_service=mysql | |
if (( $(ps -ef | grep -v grep | grep ${local_mysql_service} | wc -l) > 0 )) | |
then | |
service ${local_mysql_service} stop | |
fi | |
echo "Conflicting local services stopped ($local_mysql_service), continue..." | |
local_apache_service=apache2 | |
if (( $(ps -ef | grep -v grep | grep ${local_apache_service} | wc -l) > 0 )) | |
then | |
service ${local_apache_service} stop | |
fi | |
echo "Conflicting local services stopped ($local_apache_service), continue..." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment