Skip to content

Instantly share code, notes, and snippets.

@ribeiroevandro
Last active December 21, 2015 12:08
Show Gist options
  • Select an option

  • Save ribeiroevandro/6303632 to your computer and use it in GitHub Desktop.

Select an option

Save ribeiroevandro/6303632 to your computer and use it in GitHub Desktop.
Script for remove Virtual Servers On Apache
#!/bin/bash
# Script for remove Virtual Servers On Apache
# Check for the correct parameters
if [ $# -eq 0 ]; then
echo 'Você precisa passar o domínio a ser removido como parâmetro'
echo 'Uso: remove-site your-domain.com'
exit 0
fi
# Assign Variables
SITE=$1
# Remove the Directory which will contain your Virtual Site
if [ -d /var/www/$SITE ]; then
rm -Rf /var/www/$SITE
fi
# Remove the Sym Link to enable your Virtual Site
if [ -f /etc/apache2/sites-available/$SITE ]; then
rm -f /etc/apache2/sites-enabled/$SITE
rm -f /etc/apache2/sites-available/$SITE
fi
# Reload in service the apache2
service apache2 reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment