Last active
September 14, 2015 08:40
-
-
Save Ardakilic/590e637ffa8630e3ff56 to your computer and use it in GitHub Desktop.
-sort of- daemon script to start / stop / restart nginx, redis, php-fpm and mysql that's installed from homebrew, run as user.
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/bash | |
if [ -n "$1" ]; then | |
if [ $1 = "start" ]; then | |
echo "Starting php-fpm ..." | |
launchctl load -w /usr/local/opt/php56/homebrew.mxcl.php56.plist | |
echo "Starting nginx ..." | |
sudo nginx | |
launchctl load -w /usr/local/opt/nginx/homebrew.mxcl.nginx.plist | |
echo "Starting mysql ..." | |
launchctl load -w /usr/local/opt/mysql/homebrew.mxcl.mysql.plist | |
echo "Starting Redis..." | |
launchctl load -w /usr/local/opt/redis/homebrew.mxcl.redis.plist | |
echo "Done!" | |
elif [ $1 = "stop" ]; then | |
sudo nginx -s stop | |
echo "Stopping mysql ..." | |
launchctl unload -w /usr/local/opt/mysql/homebrew.mxcl.mysql.plist | |
echo "Stopping php-fpm ..." | |
launchctl unload -w /usr/local/opt/php56/homebrew.mxcl.php56.plist | |
echo "Stopping nginx ..." | |
sudo nginx -s stop | |
echo "Stopping Redis..." | |
launchctl unload -w /usr/local/opt/redis/homebrew.mxcl.redis.plist | |
echo "Done!" | |
elif [ $1 = "restart" ]; then | |
echo "Stopping mysql ..." | |
launchctl unload -w /usr/local/opt/mysql/homebrew.mxcl.mysql.plist | |
echo "Stopping php-fpm ..." | |
launchctl unload -w /usr/local/opt/php56/homebrew.mxcl.php56.plist | |
echo "Stopping nginx ..." | |
sudo nginx -s stop | |
launchctl unload -w /usr/local/opt/nginx/homebrew.mxcl.nginx.plist | |
echo "Stopping Redis..." | |
launchctl unload -w /usr/local/opt/redis/homebrew.mxcl.redis.plist | |
echo "Starting php-fpm ..." | |
launchctl load -w /usr/local/opt/php56/homebrew.mxcl.php56.plist | |
echo "Starting nginx ..." | |
sudo nginx | |
launchctl load -w /usr/local/opt/nginx/homebrew.mxcl.nginx.plist | |
echo "Starting mysql ..." | |
launchctl load -w /usr/local/opt/mysql/homebrew.mxcl.mysql.plist | |
echo "Starting Redis..." | |
launchctl load -w /usr/local/opt/redis/homebrew.mxcl.redis.plist | |
echo "Done!" | |
fi | |
else | |
echo "Valid commands: " | |
echo "start | stop | restart" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment