Browse Source

Move postgresql logging functions

Bob Mottram 7 years ago
parent
commit
54f4a246ed
2 changed files with 20 additions and 19 deletions
  1. 0
    19
      src/freedombone-logging
  2. 20
    0
      src/freedombone-utils-postgresql

+ 0
- 19
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
-    if [ -d /var/log/postgresql ]; then
100
-        $REMOVE_FILES_COMMAND /var/log/postgresql/*
101
-    fi
102
-}
103
-
104
-function turn_on_postgresql_logging {
105
-    if [ ! -f /etc/postgresql/9.6/main/postgresql.conf ]; then
106
-        return
107
-    fi
108
-    sed -i 's|log_destination|#log_destination|g' /etc/postgresql/9.6/main/postgresql.conf
109
-    sed -i "s|log_destination.*|log_destination = 'stderr'|g" /etc/postgresql/9.6/main/postgresql.conf
110
-}
111
-
112
 function turn_off_rsys_logging {
93
 function turn_off_rsys_logging {
113
     if ! grep -q '/var/log/auth.log' /etc/rsyslog.conf; then
94
     if ! grep -q '/var/log/auth.log' /etc/rsyslog.conf; then
114
         return
95
         return

+ 20
- 0
src/freedombone-utils-postgresql View File

29
 # Set this when calling backup and restore commands
29
 # Set this when calling backup and restore commands
30
 USE_POSTGRESQL=
30
 USE_POSTGRESQL=
31
 POSTGRESQL_PACKAGES='postgresql-9.6 postgresql-contrib-9.6 postgresql-client'
31
 POSTGRESQL_PACKAGES='postgresql-9.6 postgresql-contrib-9.6 postgresql-client'
32
+POSTGRESQL_VERSION=9.6
33
+
34
+function turn_off_postgresql_logging {
35
+    if [ ! -f /etc/postgresql/$POSTGRESQL_VERSION/main/postgresql.conf ]; then
36
+        return
37
+    fi
38
+    sed -i 's|#log_destination|log_destination|g' /etc/postgresql/$POSTGRESQL_VERSION/main/postgresql.conf
39
+    sed -i "s|log_destination.*|log_destination = 'syslog'|g" /etc/postgresql/$POSTGRESQL_VERSION/main/postgresql.conf
40
+    if [ -d /var/log/postgresql ]; then
41
+        $REMOVE_FILES_COMMAND /var/log/postgresql/*
42
+    fi
43
+}
44
+
45
+function turn_on_postgresql_logging {
46
+    if [ ! -f /etc/postgresql/$POSTGRESQL_VERSION/main/postgresql.conf ]; then
47
+        return
48
+    fi
49
+    sed -i 's|log_destination|#log_destination|g' /etc/postgresql/$POSTGRESQL_VERSION/main/postgresql.conf
50
+    sed -i "s|log_destination.*|log_destination = 'stderr'|g" /etc/postgresql/$POSTGRESQL_VERSION/main/postgresql.conf
51
+}
32
 
52
 
33
 function store_original_postgresql_password {
53
 function store_original_postgresql_password {
34
     if [ ! -f /root/.postgresqloriginal ]; then
54
     if [ ! -f /root/.postgresqloriginal ]; then