Browse Source

Turn off postgresql logging

Bob Mottram 7 years ago
parent
commit
be74c3040a
1 changed files with 21 additions and 0 deletions
  1. 21
    0
      src/freedombone-logging

+ 21
- 0
src/freedombone-logging View File

@@ -90,6 +90,22 @@ function turn_logging_off {
90 90
     done
91 91
 }
92 92
 
93
+function turn_off_postgresql_logging {
94
+    if [ ! -f /etc/postgresql/9.6/main/postgresql.conf ]; then
95
+        return
96
+    fi
97
+    sed -i 's|#log_destination|log_destination|g' /etc/postgresql/9.6/main/postgresql.conf
98
+    sed -i "s|log_destination.*|log_destination = 'syslog'|g" /etc/postgresql/9.6/main/postgresql.conf
99
+}
100
+
101
+function turn_on_postgresql_logging {
102
+    if [ ! -f /etc/postgresql/9.6/main/postgresql.conf ]; then
103
+        return
104
+    fi
105
+    sed -i 's|log_destination|#log_destination|g' /etc/postgresql/9.6/main/postgresql.conf
106
+    sed -i "s|log_destination.*|log_destination = 'stderr'|g" /etc/postgresql/9.6/main/postgresql.conf
107
+}
108
+
93 109
 function turn_off_rsys_logging {
94 110
     if ! grep -q '/var/log/auth.log' /etc/rsyslog.conf; then
95 111
         return
@@ -199,6 +215,7 @@ if [[ "$1" == "on" || "$1" == "On" || "$1" == "ON" ]]; then
199 215
         fi
200 216
     fi
201 217
     turn_on_rsys_logging
218
+    turn_on_postgresql_logging
202 219
 else
203 220
     turn_logging_off
204 221
 
@@ -256,6 +273,7 @@ else
256 273
         fi
257 274
     fi
258 275
     turn_off_rsys_logging
276
+    turn_off_postgresql_logging
259 277
 fi
260 278
 
261 279
 if [ -d /etc/exim4 ]; then
@@ -301,5 +319,8 @@ fi
301 319
 if [ -d /etc/matrix ]; then
302 320
     systemctl restart matrix
303 321
 fi
322
+if [ -d /etc/postgresql ]; then
323
+    systemctl restart postgresql
324
+fi
304 325
 
305 326
 exit 0