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
     done
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
 function turn_off_rsys_logging {
109
 function turn_off_rsys_logging {
94
     if ! grep -q '/var/log/auth.log' /etc/rsyslog.conf; then
110
     if ! grep -q '/var/log/auth.log' /etc/rsyslog.conf; then
95
         return
111
         return
199
         fi
215
         fi
200
     fi
216
     fi
201
     turn_on_rsys_logging
217
     turn_on_rsys_logging
218
+    turn_on_postgresql_logging
202
 else
219
 else
203
     turn_logging_off
220
     turn_logging_off
204
 
221
 
256
         fi
273
         fi
257
     fi
274
     fi
258
     turn_off_rsys_logging
275
     turn_off_rsys_logging
276
+    turn_off_postgresql_logging
259
 fi
277
 fi
260
 
278
 
261
 if [ -d /etc/exim4 ]; then
279
 if [ -d /etc/exim4 ]; then
301
 if [ -d /etc/matrix ]; then
319
 if [ -d /etc/matrix ]; then
302
     systemctl restart matrix
320
     systemctl restart matrix
303
 fi
321
 fi
322
+if [ -d /etc/postgresql ]; then
323
+    systemctl restart postgresql
324
+fi
304
 
325
 
305
 exit 0
326
 exit 0