#!/bin/bash
if [ $1 == 5 ]
then
echo "当前启动版本".$1
version_fpm=$1
elif [ $1 == 7 ]
then
echo "当前启动版本".$1
version_fpm=$1
else
echo "参数不符合标准,默认7"
version_fpm=7
fi
echo $version_fpm
echo "Stopping php7-fpm..."
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.php71.plist
echo "Stopping php5-fpm..."
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
if [ $version_fpm == 5 ]
then
echo "Starting php5-fpm..."
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
else
if [ $1 == 5 ]
then
echo "当前启动版本".$1
version_fpm=$1
elif [ $1 == 7 ]
then
echo "当前启动版本".$1
version_fpm=$1
else
echo "参数不符合标准,默认7"
version_fpm=7
fi
echo $version_fpm
echo "Stopping php7-fpm..."
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.php71.plist
echo "Stopping php5-fpm..."
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
if [ $version_fpm == 5 ]
then
echo "Starting php5-fpm..."
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
else
echo "Starting php7-fpm..."
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php71.plist
fi
echo "php-fpm restarted"
exit 0