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

@@ -1,29 +1,39 @@
function usage { function usage {
echo "Usage: $0 [option...]" >&2 echo "Usage: $0 [option...]" >&2
echo echo
echo " -e, Enable Netdata" echo " -e, Enable Netdata"
echo " -d, Disable Netdata" echo " -d, Disable Netdata"
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 Netdata" touch /etc/ICTM/toggle.conf
sed -i '/deny all; #enables\/disables Netdata/c\ deny all; #enables\/disables Netdata' /etc/nginx/sites-available/Backend fi
systemctl stop netdata source /etc/ICTM/toggle.conf
systemctl disable netdata > /dev/null 2>&1 if [ -z "$NetDa" ]; then
systemctl reload nginx echo "Creating Var"
elif [ "$1" = "-e" ]; then echo "NetDa=3" >> /etc/ICTM/toggle.conf
echo "Enable Netdata" NetDa=3
sed -i '/deny all; #enables\/disables Netdata/c\ #deny all; #enables\/disables Netdata' /etc/nginx/sites-available/Backend fi
systemctl start netdata if [[ "$1" = "-d" && "$NetDa" != 0 ]]; then
systemctl enable netdata > /dev/null 2>&1 echo "Disable Netdata"
systemctl reload nginx 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" && "$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
elif [[ "$1" = "-h" ]]; then
usage
else
echo "Oopsie!"
fi
else else
usage usage
fi fi
else
usage
fi