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 }