From daa36d9f5aeae6a8e6450ff9807ffe89d9d4ecf1 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 10 Aug 2017 14:27:04 +0100 Subject: [PATCH] Matrix logging --- src/freedombone-app-matrix | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/freedombone-app-matrix b/src/freedombone-app-matrix index 9873db71..97aa4c6f 100755 --- a/src/freedombone-app-matrix +++ b/src/freedombone-app-matrix @@ -64,7 +64,9 @@ matrix_variables=(ONION_ONLY function logging_on_matrix { if [ -f /var/lib/matrix/homeserver.yaml ]; then - sed -i 's|log_file:.*|log_file: /etc/matrix/homeserver.log|g' /var/lib/matrix/homeserver.yaml + if ! grep -q "log_file: /etc/matrix/homeserver.log" /var/lib/matrix/homeserver.yaml; then + sed -i 's|log_file:.*|log_file: /etc/matrix/homeserver.log|g' /var/lib/matrix/homeserver.yaml + fi if ! grep -q "#log_config:" /var/lib/matrix/homeserver.yaml; then sed -i 's|log_config:|#log_config:|g' /var/lib/matrix/homeserver.yaml fi @@ -73,7 +75,9 @@ function logging_on_matrix { function logging_off_matrix { if [ -f /var/lib/matrix/homeserver.yaml ]; then - sed -i 's|log_file:.*|log_file: /dev/null|g' /var/lib/matrix/homeserver.yaml + if ! grep -q "log_file: /dev/null" /var/lib/matrix/homeserver.yaml; then + sed -i 's|log_file:.*|log_file: /dev/null|g' /var/lib/matrix/homeserver.yaml + fi if ! grep -q "#log_config:" /var/lib/matrix/homeserver.yaml; then sed -i 's|log_config:|#log_config:|g' /var/lib/matrix/homeserver.yaml fi @@ -83,6 +87,12 @@ function logging_off_matrix { if [ -f /etc/matrix/homeserver.log.1 ]; then $REMOVE_FILES_COMMAND /etc/matrix/homeserver.log.1 fi + if [ -f /etc/matrix/homeserver.log.2 ]; then + $REMOVE_FILES_COMMAND /etc/matrix/homeserver.log.2 + fi + if [ -f /etc/matrix/homeserver.log.3 ]; then + $REMOVE_FILES_COMMAND /etc/matrix/homeserver.log.3 + fi fi }