Created
August 3, 2012 21:29
-
-
Save mateusg/3251694 to your computer and use it in GitHub Desktop.
Script for disabling a site, just like a2dissite, from Apache2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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