#!/bin/bash
function startWebServer(){
sudo systemctl start php-fpm
echo ‘start php DONE’
sudo systemctl start nginx
echo ‘start nginx DONE’
sudo systemctl start mysqld
echo ‘start mysqld DONE’
}

function stopWebServer(){
sudo systemctl stop php-fpm
echo ‘stop php DONE’
sudo systemctl stop nginx
echo ‘stop nginx DONE’
sudo systemctl stop mysqld
echo ‘stop mysqld DONE’
}

function statusWebServer(){
echo ‘PHP:’
sudo systemctl status php-fpm|grep Active
echo ‘NGINX:’
sudo systemctl status nginx|grep Active
echo ‘MYSQL:’
sudo systemctl status mysqld|grep Active
}

case $1 in
start) startWebServer ;;
stop) stopWebServer ;;
status) statusWebServer ;;
*)
echo “USAGE: $0 start|stop|status” >&2 ;;
esac