Following is what the script does
1. chks if the domin exist
2. chks if there is alreaady a protected folder
3. if both are true then it removes the content frm the httpd_vhost.conf file
#!/bin/bash
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
sed -i "/\#dir_protection_${d}_${f}\#/,/\#dir_protection_${d}_${f}\#/d" /usr/local/apache2/conf/extra/httpd_vhost.conf
else
echo -e "virtusl host doesnot exist"
fi
else
echo -e " the folder /$f does not exist"
fi
else
echo -e "the Domain $d does not exist"
fi
echo -e "virtusl host doesnot 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