Last active
December 15, 2015 03:09
-
-
Save c3mdigital/5192074 to your computer and use it in GitHub Desktop.
Bash script to start, stop and reload local installed servers.
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 | |
#This bash script controls starting and stopping the homebrew installed Nginx, PHP-FPM and MySql servers | |
start=start | |
stop=stop | |
restart=restart | |
status=status | |
echo server $1 executed.. | |
if [ $1 == $start ]; then | |
echo "Starting servers..." | |
sudo nginx | |
launchctl load -w ~/Library/LaunchAgents/homebrew-php.josegonzalez.php53.plist | |
mysql.server start | |
memcached -d -p 11211 | |
memcached -h | grep 'memcached 1' | |
echo "Nginx, PHP-FPM, Memcached and MySql now running..." | |
elif [ $1 == $stop ]; then | |
echo "Stopping servers...." | |
sudo nginx -s stop | |
launchctl unload -w ~/Library/LaunchAgents/homebrew-php.josegonzalez.php53.plist | |
mysql.server stop | |
killall memcached | |
echo "Nginx, PHP-FPM, Memcached and MySql are now stopped..." | |
elif [ $1 == $restart ]; then | |
echo "Restarting servers...." | |
sudo nginx -s stop | |
launchctl unload -w ~/Library/LaunchAgents/homebrew-php.josegonzalez.php53.plist | |
killall memcached | |
mysql.server stop | |
echo "Nginx, PHP-FPM, and MySql are now stopped..." | |
echo "Restarting servers..." | |
sudo nginx | |
launchctl load -w ~/Library/LaunchAgents/homebrew-php.josegonzalez.php53.plist | |
mysql.server start | |
memcached -d -p 11211 | |
memcached -h | grep 'memcached 1' | |
echo "Nginx, PHP-FPM, and MySql now running..." | |
elif [ $1 == $status ]; then | |
mysql.server status | |
php -v | |
nginx -v | |
memcached -h | grep 'memcached 1' | |
else | |
echo "Please enter a command [start|restart|stop|status]" | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Based on brew server installation detailed here, http://xig.me/osx-php-mysql-nginx.html.