脚本内容
#!/bin/bash
echo 'MySQL Nginx PHP 启动脚本'
echo '启动 MySQL 请输入 1'
echo '启动 Nginx 请输入 2'
echo '启动 PHP 请输入 3'
echo '重启 MySQL 请输入 4'
echo '重启 Nginx 请输入 5'
echo '重启 PHP 请输入 6'
echo '停止 MySQL 请输入 7'
echo '停止 Nginx 请输入 8'
echo '停止 PHP 请输入 9'
echo '重启 MySQL、Nginx、PHP 请输入 10'
echo '停止 MySQL、Nginx、PHP 请输入 11'
echo '启动 MySQL、Nginx、PHP 请输入 0'
read aNum
case $aNum in
1) brew services start mysql@5.6 ;;
2) brew services start nginx ;;
3) brew services start php@7.2 ;;
4) brew services restart mysql@5.6 ;;
5) brew services restart nginx ;;
6) brew services restart php@7.2 ;;
7) brew services stop mysql@5.6 ;;
8) brew services stop nginx ;;
9) brew services stop php@7.2 ;;
10)
brew services restart mysql@5.6
brew services restart nginx
brew services restart php@7.2
;;
11)
brew services stop mysql@5.6
brew services stop nginx
brew services stop php@7.2
;;
*)
brew services start mysql@5.6
brew services start nginx
brew services start php@7.2
;;
esac
echo '启动服务成功!'
给文件权限
chmod +x ./MysqlAndNginxStart.sh
运行脚本
./MysqlAndNginxStart.sh