Update 'Scripts/toggles/toggle-PhpMyAdmin_NGINX.sh'

This commit is contained in:
Bram Prieshof
2020-08-06 12:51:31 +02:00
parent 3087ac7ca7
commit dfe551210d

View File

@@ -1,25 +1,37 @@
function usage { function usage {
echo "Usage: $0 [option...]" >&2 echo "Usage: $0 [option...]" >&2
echo echo
echo " -e, Enable PhpMyadmin" echo " -e, Enable PhpMyadmin"
echo " -d, Disable PhpMyadmin" echo " -d, Disable PhpMyadmin"
echo echo " -h, Shows this information"
echo
} }
if [ -n "$1" ]; then if [ -n "$1" ]; then
if [[ ! -f /etc/ICTM/toggle.conf ]]; then
if [ "$1" = "-d" ]; then echo "Creating File"
echo "Disable PhpMyadmin" touch /etc/ICTM/toggle.conf
sed -i '/deny all; #enables\/disables PHPMyadmin/c\ deny all; #enables\/disables PHPMyadmin' /etc/nginx/sites-available/Backend fi
systemctl reload nginx source /etc/ICTM/toggle.conf
elif [ "$1" = "-e" ]; then if [ -z "$PhpMA" ]; then
echo "Enable PhpMyadmin" echo "Creating Var"
sed -i '/deny all; #enables\/disables PHPMyadmin/c\ #deny all; #enables\/disables PHPMyadmin' /etc/nginx/sites-available/Backend echo "PhpMA=3" >> /etc/ICTM/toggle.conf
systemctl reload nginx PhpMA=3
fi
if [[ "$1" = "-d" && "$PhpMA" != 0 ]]; then
echo "Disable PhpMyadmin"
sed -i '/PhpMA=/c\PhpMA=0' /etc/ICTM/toggle.conf
sed -i '/deny all; #enables\/disables PHPMyadmin/c\ deny all; #enables\/disables PHPMyadmin' /etc/nginx/sites-available/Backend
systemctl reload nginx
elif [[ "$1" = "-e" && "$PhpMA" != 1 ]]; then
echo "Enable PhpMyadmin"
sed -i '/PhpMA=/c\PhpMA=1' /etc/ICTM/toggle.conf
sed -i '/deny all; #enables\/disables PHPMyadmin/c\ #deny all; #enables\/disables PHPMyadmin' /etc/nginx/sites-available/Backend
systemctl reload nginx
elif [[ "$1" = "-h" ]]; then
usage
else
echo "Oopsie!"
fi
else else
usage usage
fi fi
else
usage
fi