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

This commit is contained in:
Bram Prieshof
2020-08-06 12:55:51 +02:00
parent dfe551210d
commit b3b08a3439

View File

@@ -3,27 +3,37 @@ function usage {
echo
echo " -e, Enable Netdata"
echo " -d, Disable Netdata"
echo " -h, Shows this information"
echo
}
if [ -n "$1" ]; then
if [ "$1" = "-d" ]; then
if [[ ! -f /etc/ICTM/toggle.conf ]]; then
echo "Creating File"
touch /etc/ICTM/toggle.conf
fi
source /etc/ICTM/toggle.conf
if [ -z "$NetDa" ]; then
echo "Creating Var"
echo "NetDa=3" >> /etc/ICTM/toggle.conf
NetDa=3
fi
if [[ "$1" = "-d" && "$NetDa" != 0 ]]; then
echo "Disable Netdata"
sed -i '/deny all; #enables\/disables Netdata/c\ deny all; #enables\/disables Netdata' /etc/nginx/sites-available/Backend
systemctl stop netdata
systemctl disable netdata > /dev/null 2>&1
systemctl reload nginx
elif [ "$1" = "-e" ]; then
elif [[ "$1" = "-e" && "$NetDa" != 1 ]]; then
echo "Enable Netdata"
sed -i '/deny all; #enables\/disables Netdata/c\ #deny all; #enables\/disables Netdata' /etc/nginx/sites-available/Backend
systemctl start netdata
systemctl enable netdata > /dev/null 2>&1
systemctl reload nginx
else
usage
fi
elif [[ "$1" = "-h" ]]; then
usage
else
echo "Oopsie!"
fi
else
usage
fi