Bob Mottram преди 7 години
родител
ревизия
c945b7d402
променени са 2 файла, в които са добавени 17 реда и са изтрити 4 реда
  1. 1
    0
      src/freedombone-app-matrix
  2. 16
    4
      src/freedombone-logging

+ 1
- 0
src/freedombone-app-matrix Целия файл

@@ -228,6 +228,7 @@ function matrix_configure_homeserver_yaml {
228 228
     sed -i "s|media_store_path:.*|media_store_path: \"${MATRIX_DATA_DIR}/media_store\"|g" "${filepath}"
229 229
     sed -i "s|pid_file:.*|pid_file: \"${MATRIX_DATA_DIR}/homeserver.pid\"|g" "${filepath}"
230 230
     sed -i "s|log_file:.*|log_file: \"/dev/null\"|g" "${filepath}"
231
+    sed -i "s|log_config:|#log_config:|g" "${filepath}"
231 232
     sed -i 's|bind_address:.*|bind_address: 127.0.0.1|g' "${filepath}"
232 233
     sed -i "s|bind_addresses:.*|bind_addresses: ['127.0.0.1']|g" "${filepath}"
233 234
     sed -i 's|x_forwarded:.*|x_forwarded: false|g' "${filepath}"

+ 16
- 4
src/freedombone-logging Целия файл

@@ -78,13 +78,16 @@ if [ ! "$1" ]; then
78 78
 fi
79 79
 
80 80
 if [[ "$1" == "on" || "$1" == "On" || "$1" == "ON" ]]; then
81
+    if [ -f /var/lib/matrix/homeserver.yaml ]; then
82
+        sed -i 's|log_file:.*|log_file: /etc/matrix/homeserver.log|g' /var/lib/matrix/homeserver.yaml
83
+        if ! grep -q "#log_config:" /var/lib/matrix/homeserver.yaml; then
84
+            sed -i 's|log_config:|#log_config:|g' /var/lib/matrix/homeserver.yaml
85
+        fi
86
+    fi
81 87
     if [ -f /etc/fail2ban/fail2ban.conf ]; then
82 88
         sed -i 's|loglevel.*|loglevel = 3|g' /etc/fail2ban/fail2ban.conf
83 89
         sed -i 's|logtarget.*|logtarget = /var/log/fail2ban.log|g' /etc/fail2ban/fail2ban.conf
84 90
     fi
85
-    if [ -f /var/lib/matrix/homeserver.yaml ]; then
86
-        sed -i 's|log_file:.*|log_file: /var/lib/matrix/homeserver.log|g' /var/lib/matrix/homeserver.yaml
87
-    fi
88 91
     if [ -d /etc/tor ]; then
89 92
         if [ ! -f /var/log/tor.log ]; then
90 93
             touch /var/log/tor.log
@@ -148,6 +151,15 @@ if [[ "$1" == "on" || "$1" == "On" || "$1" == "ON" ]]; then
148 151
 else
149 152
     if [ -f /var/lib/matrix/homeserver.yaml ]; then
150 153
         sed -i 's|log_file:.*|log_file: /dev/null|g' /var/lib/matrix/homeserver.yaml
154
+        if ! grep -q "#log_config:" /var/lib/matrix/homeserver.yaml; then
155
+            sed -i 's|log_config:|#log_config:|g' /var/lib/matrix/homeserver.yaml
156
+        fi
157
+        if [ -f /etc/matrix/homeserver.log ]; then
158
+            shred -zu /etc/matrix/homeserver.log
159
+        fi
160
+        if [ -f /etc/matrix/homeserver.log.1 ]; then
161
+            shred -zu /etc/matrix/homeserver.log.1
162
+        fi
151 163
     fi
152 164
     if [ -d /etc/tor ]; then
153 165
         sed -i 's|#Log notice file.*|Log notice file /dev/null|g' /etc/tor/torrc
@@ -261,7 +273,7 @@ fi
261 273
 if [ -d /etc/fail2ban ]; then
262 274
     systemctl restart fail2ban
263 275
 fi
264
-if [ -f /var/lib/matrix/homeserver.yaml ]; then
276
+if [ -d /etc/matrix ]; then
265 277
     systemctl restart matrix
266 278
 fi
267 279