Skip to content

Instantly share code, notes, and snippets.

@mateusg
Created August 3, 2012 21:29
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mateusg/3251694 to your computer and use it in GitHub Desktop.
Save mateusg/3251694 to your computer and use it in GitHub Desktop.
Script for disabling a site, just like a2dissite, from Apache2
#! /bin/bash
# Disables a site, just like a2dissite command, from Apache2.
SITES_AVAILABLE_CONFIG_DIR="/opt/nginx/sites-available";
SITES_ENABLED_CONFIG_DIR="/opt/nginx/sites-enabled";
if [ $1 ]; then
if [ ! -f "${SITES_ENABLED_CONFIG_DIR}/${1}" ]; then
echo "Site ${1} was already disabled!"
elif [ ! -w $SITES_ENABLED_CONFIG_DIR ]; then
echo "You don't have permission to do this. Try to run the command as root."
else
echo "Disabling site ${1}..."
rm $SITES_ENABLED_CONFIG_DIR/$1
echo "done!"
fi
else
echo "Please, inform the name of the site to be disabled."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment