Skip to content

Instantly share code, notes, and snippets.

@wangzuo
Last active August 29, 2015 14:05
Show Gist options
  • Select an option

  • Save wangzuo/e2865d190169fd89ba53 to your computer and use it in GitHub Desktop.

Select an option

Save wangzuo/e2865d190169fd89ba53 to your computer and use it in GitHub Desktop.
switch between nginx and apache
NGINX=$(ps aux | grep -c nginx)
if [ $NGINX -eq 1 ]
then
echo 'stop apache, start nginx';
sudo apachectl stop; sudo nginx;
else
echo 'stop nginx, start apache';
sudo nginx -s stop; sudo apachectl start;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment