this script assumes the following
1) websites are located at /websites/domain.com
2) the vhost_config file is located at /usr/local/apache2/conf/extra/httpd_vhost.conf
3) all folder that you wish to directory protect are loated at /websites/domain.com/folder1/subfolder1
#!/bin/bash
clear
read -p "Enter your domain: " d
read -p "Enter the directory that you want to delete: " f
if [ -d /websites/"$d" ]; then
if [ -d /websites/"$d"/web/"$f" ]; then
if [ -n "$(sed -n "/\#dir_protection_${d}_${f}#/,/&/p" /usr/local/apache2/conf/extra/httpd_vhost.conf)" ]; then
sed -i "/\#dir_protection_${d}_${f}\#/,/\#dir_protection_${d}_${f}\#/d" /usr/local/apache2/conf/extra/httpd_vhost.conf
else
echo -e "the directory protection for folder /$f does not exist"
fi
else
echo -e " the folder /$f does not exist"
fi
else
echo -e "the Domain $d does not exist"
fi
--
clear
read -p "Enter your domain: " d
read -p "Enter the directory that you want to delete: " f
if [ -d /websites/"$d" ]; then
if [ -d /websites/"$d"/web/"$f" ]; then
if [ -n "$(sed -n "/\#dir_protection_${d}_${f}#/,/&/p" /usr/local/apache2/conf/extra/httpd_vhost.conf)" ]; then
sed -i "/\#dir_protection_${d}_${f}\#/,/\#dir_protection_${d}_${f}\#/d" /usr/local/apache2/conf/extra/httpd_vhost.conf
else
echo -e "the directory protection for folder /$f does not exist"
fi
else
echo -e " the folder /$f does not exist"
fi
else
echo -e "the Domain $d does not exist"
fi
--
No comments:
Post a Comment