瀏覽代碼

Move postgresql logging functions

Bob Mottram 7 年之前
父節點
當前提交
54f4a246ed
共有 2 個文件被更改,包括 20 次插入19 次删除
  1. 0
    19
      src/freedombone-logging
  2. 20
    0
      src/freedombone-utils-postgresql

+ 0
- 19
src/freedombone-logging 查看文件

@@ -90,25 +90,6 @@ 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
-    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 93
 function turn_off_rsys_logging {
113 94
     if ! grep -q '/var/log/auth.log' /etc/rsyslog.conf; then
114 95
         return

+ 20
- 0
src/freedombone-utils-postgresql 查看文件

@@ -29,6 +29,26 @@
29 29
 # Set this when calling backup and restore commands
30 30
 USE_POSTGRESQL=
31 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 53
 function store_original_postgresql_password {
34 54
     if [ ! -f /root/.postgresqloriginal ]; then