Created
March 9, 2015 19:37
-
-
Save mmstick/070d9a9e6457972c03fd to your computer and use it in GitHub Desktop.
An Apache2 script for disabling websites.
This file contains hidden or 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 | |
avail=/etc/httpd/conf/sites-enabled/$1.conf | |
enabled=/etc/httpd/conf/sites-enabled | |
site=`ls /etc/httpd/conf/sites-enabled` | |
if [ "$#" != "1" ]; then | |
echo "Use script: n2dissite virtual_site" | |
echo -e "\nAvailable virtual hosts: \n$site" | |
exit 0 | |
else | |
if test -e $avail; then | |
sudo rm $avail | |
else | |
echo -e "$avail virtual host does not exist! Exiting" | |
exit 0 | |
fi | |
if test -e $enabled/$1.conf; then | |
echo "Error!! Could not remove $avail virtual host!" | |
else | |
echo -e "Success! $avail has been removed!\nsudo systemctl restart httpd" | |
exit 0 | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment