|
@@ -219,28 +219,20 @@ elif [[ -n $only_error ]]; then
|
|
|
|
|
|
# Global-Conf
|
|
|
if [[ -z $domain ]]; then
|
|
|
- [[ $(conf_read nginx) == "true" ]] && islog=$( grep -F "access_log off;" /etc/nginx/nginx.conf )
|
|
|
if [[ $only_error == "on" ]]; then
|
|
|
api-events_update lg1
|
|
|
- if [[ -z $islog ]]; then
|
|
|
- [[ $(conf_read nginx) == "true" ]] && sudo sed -i '/access_log/c \ access_log off;' /etc/nginx/nginx.conf
|
|
|
- conf_write global-access-log-off true
|
|
|
- sudo systemctl reload nginx
|
|
|
- echo "${gre}Only-Error Log was successfully enabled (global)!${end}"
|
|
|
- else
|
|
|
- echo "${gre}Only-Error Log is already enabled (global)!${end}"
|
|
|
- fi
|
|
|
+ [[ $(conf_read nginx) == "true" ]] && sudo sed -i '/access_log /c \ access_log off;' /etc/nginx/nginx.conf
|
|
|
+ conf_write global-access-log-off true
|
|
|
+ echo "${gre}Only-Error Log was successfully enabled (global)!${end}"
|
|
|
elif [[ $only_error == "off" ]]; then
|
|
|
api-events_update lg2
|
|
|
- if [[ -n $islog || ( -z $islog && $(conf_read nginx) != "true" ) ]]; then
|
|
|
- [[ $(conf_read nginx) == "true" ]] && sudo sed -i "/access_log/c \ access_log \/var\/log\/nginx\/access.log;" /etc/nginx/nginx.conf
|
|
|
- conf_write global-access-log-off false
|
|
|
- sudo systemctl reload nginx
|
|
|
- echo "${gre}Only-Error Log was successfully disabled (global)!${end}"
|
|
|
- else
|
|
|
- echo "${gre}Only-Error Log is already disabled (global)!${end}"
|
|
|
- fi
|
|
|
+ [[ $(conf_read nginx) == "true" ]] && sudo sed -i "/access_log /c \ access_log \/var\/log\/nginx\/access.log $(check_var nginx-log-format);" /etc/nginx/nginx.conf
|
|
|
+ conf_write global-access-log-off false
|
|
|
+ echo "${gre}Only-Error Log was successfully disabled (global)!${end}"
|
|
|
fi
|
|
|
+
|
|
|
+ [[ $(check_var nginx-error-log-level) != "false" ]] && sudo sed -i "/error_log /c \ error_log \/var\/log\/nginx\/error.log $(check_var nginx-error-log-level);" /etc/nginx/nginx.conf
|
|
|
+ sudo systemctl reload nginx
|
|
|
fi
|
|
|
|
|
|
# Per site
|
|
@@ -253,23 +245,17 @@ elif [[ -n $only_error ]]; then
|
|
|
|
|
|
if [[ $only_error == "on" ]]; then
|
|
|
api-events_update lg3
|
|
|
- if [[ $(is_log $domain) == "true" ]]; then
|
|
|
- sudo sed -i '/access_log/c \ access_log off;' /etc/nginx/sites-available/$domain
|
|
|
- sudo systemctl reload nginx
|
|
|
- echo "${gre}Only-Error Log was successfully enabled for ${blu}${domain} ${gre}site!${end}"
|
|
|
- else
|
|
|
- echo "${gre}Access Log is already enabled for ${blu}${domain} ${gre}site!${end}"
|
|
|
- fi
|
|
|
+ sudo sed -i '/access_log /c \ access_log off;' /etc/nginx/sites-available/$domain
|
|
|
+ echo "${gre}Only-Error Log was successfully enabled for ${blu}${domain} ${gre}site!${end}"
|
|
|
elif [[ $only_error == "off" ]]; then
|
|
|
api-events_update lg4
|
|
|
- if [[ $(is_log $domain) != "true" ]]; then
|
|
|
- sudo sed -i "/access_log/c \ access_log \/var\/log\/nginx\/${domain}.access.log we_log;" /etc/nginx/sites-available/$domain
|
|
|
- sudo systemctl reload nginx
|
|
|
- echo "${gre}Only-Error Log was successfully disabled for ${blu}${domain} ${gre}site!${end}"
|
|
|
- else
|
|
|
- echo "${gre}Access Log is already disabled for ${blu}${domain} ${gre}site!${end}"
|
|
|
- fi
|
|
|
+ sudo sed -i "/access_log /c \ access_log \/var\/log\/nginx\/${domain}.access.log $(check_var nginx-log-format);" /etc/nginx/sites-available/$domain
|
|
|
+ echo "${gre}Only-Error Log was successfully disabled for ${blu}${domain} ${gre}site!${end}"
|
|
|
fi
|
|
|
+
|
|
|
+ [[ $(check_var nginx-error-log-level) != "false" ]] && sudo sed -i "/error_log /c \ error_log \/var\/log\/nginx\/${domain}.error.log $(check_var nginx-error-log-level);" /etc/nginx/sites-available/$domain
|
|
|
+ sudo systemctl reload nginx
|
|
|
+
|
|
|
elif [[ -n $domain && ! -f /etc/nginx/sites-available/$domain ]]; then
|
|
|
echo "${red}[ERROR] Domain not found!${end}"
|
|
|
exit 1
|