Skip to content

Instantly share code, notes, and snippets.

@mafikes
Last active January 2, 2016 21:49
Show Gist options
  • Save mafikes/8366441 to your computer and use it in GitHub Desktop.
Save mafikes/8366441 to your computer and use it in GitHub Desktop.
Bash script for manage nginx, mysql server, php-fpm
#!/bin/bash
# WEBSERVER / Webserver.sh
# By Martin Antoš, mafikes.cz
# Script for manage nginx, mysql, php
#
# FUNCTION
#
start() {
echo -e "\n [Webserver]: Starting nginx..."
sudo nginx
echo -e "\n [Webserver]: Starting mysql..."
mysql.server start
echo -e "\n [Webserver]: Starting php-fpm..."
sudo php-fpm
}
stop() {
echo -e "\n [Webserver]: Stopping nginx..."
sudo nginx -s stop
echo -e "\n [Webserver]: Stopping mysql..."
mysql.server stop
echo -e "\n [Webserver]: Stopping php-fpm..."
sudo killall php-fpm
}
#
# MAIN
#
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment