Update 'Scripts/toggles/toggle-Netdata_NGINX.sh'
This commit is contained in:
@@ -3,26 +3,36 @@ function usage {
|
|||||||
echo
|
echo
|
||||||
echo " -e, Enable Netdata"
|
echo " -e, Enable Netdata"
|
||||||
echo " -d, Disable Netdata"
|
echo " -d, Disable Netdata"
|
||||||
|
echo " -h, Shows this information"
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if [ -n "$1" ]; then
|
if [ -n "$1" ]; then
|
||||||
|
if [[ ! -f /etc/ICTM/toggle.conf ]]; then
|
||||||
if [ "$1" = "-d" ]; 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"
|
echo "Disable Netdata"
|
||||||
sed -i '/deny all; #enables\/disables Netdata/c\ deny all; #enables\/disables Netdata' /etc/nginx/sites-available/Backend
|
sed -i '/deny all; #enables\/disables Netdata/c\ deny all; #enables\/disables Netdata' /etc/nginx/sites-available/Backend
|
||||||
systemctl stop netdata
|
systemctl stop netdata
|
||||||
systemctl disable netdata > /dev/null 2>&1
|
systemctl disable netdata > /dev/null 2>&1
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
elif [ "$1" = "-e" ]; then
|
elif [[ "$1" = "-e" && "$NetDa" != 1 ]]; then
|
||||||
echo "Enable Netdata"
|
echo "Enable Netdata"
|
||||||
sed -i '/deny all; #enables\/disables Netdata/c\ #deny all; #enables\/disables Netdata' /etc/nginx/sites-available/Backend
|
sed -i '/deny all; #enables\/disables Netdata/c\ #deny all; #enables\/disables Netdata' /etc/nginx/sites-available/Backend
|
||||||
systemctl start netdata
|
systemctl start netdata
|
||||||
systemctl enable netdata > /dev/null 2>&1
|
systemctl enable netdata > /dev/null 2>&1
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
else
|
elif [[ "$1" = "-h" ]]; then
|
||||||
usage
|
usage
|
||||||
|
else
|
||||||
|
echo "Oopsie!"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
usage
|
usage
|
||||||
|
|||||||
Reference in New Issue
Block a user