From d6cf09973fdacca30163a0dd202e1e3669ed526d Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob@freedombone.net>
Date: Fri, 30 Dec 2016 22:05:34 +0000
Subject: [PATCH] Turn matrix logging on or off

---
 src/freedombone-logging | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/freedombone-logging b/src/freedombone-logging
index 8b732ab9c..3004a73b9 100755
--- a/src/freedombone-logging
+++ b/src/freedombone-logging
@@ -82,6 +82,9 @@ if [[ "$1" == "on" || "$1" == "On" || "$1" == "ON" ]]; then
         sed -i 's|loglevel.*|loglevel = 3|g' /etc/fail2ban/fail2ban.conf
         sed -i 's|logtarget.*|logtarget = /var/log/fail2ban.log|g' /etc/fail2ban/fail2ban.conf
     fi
+    if [ -f /var/lib/matrix/homeserver.yaml ]; then
+        sed -i 's|log_file:.*|log_file: /var/lib/matrix/homeserver.log|g' /var/lib/matrix/homeserver.yaml
+    fi
     if [ -d /etc/tor ]; then
         if [ ! -f /var/log/tor.log ]; then
             touch /var/log/tor.log
@@ -143,6 +146,9 @@ if [[ "$1" == "on" || "$1" == "On" || "$1" == "ON" ]]; then
     fi
     turn_on_rsys_logging
 else
+    if [ -f /var/lib/matrix/homeserver.yaml ]; then
+        sed -i 's|log_file:.*|log_file: /dev/null|g' /var/lib/matrix/homeserver.yaml
+    fi
     if [ -d /etc/tor ]; then
         sed -i 's|#Log notice file.*|Log notice file /dev/null|g' /etc/tor/torrc
         sed -i 's|Log notice file.*|Log notice file /dev/null|g' /etc/tor/torrc
@@ -255,5 +261,8 @@ fi
 if [ -d /etc/fail2ban ]; then
     systemctl restart fail2ban
 fi
+if [ -f /var/lib/matrix/homeserver.yaml ]; then
+    systemctl restart matrix
+fi
 
 exit 0
-- 
GitLab