diff --git a/src/freedombone-logging b/src/freedombone-logging index b76b4028..eafe5be0 100755 --- a/src/freedombone-logging +++ b/src/freedombone-logging @@ -90,25 +90,6 @@ function turn_logging_off { done } -function turn_off_postgresql_logging { - if [ ! -f /etc/postgresql/9.6/main/postgresql.conf ]; then - return - fi - sed -i 's|#log_destination|log_destination|g' /etc/postgresql/9.6/main/postgresql.conf - sed -i "s|log_destination.*|log_destination = 'syslog'|g" /etc/postgresql/9.6/main/postgresql.conf - if [ -d /var/log/postgresql ]; then - $REMOVE_FILES_COMMAND /var/log/postgresql/* - fi -} - -function turn_on_postgresql_logging { - if [ ! -f /etc/postgresql/9.6/main/postgresql.conf ]; then - return - fi - sed -i 's|log_destination|#log_destination|g' /etc/postgresql/9.6/main/postgresql.conf - sed -i "s|log_destination.*|log_destination = 'stderr'|g" /etc/postgresql/9.6/main/postgresql.conf -} - function turn_off_rsys_logging { if ! grep -q '/var/log/auth.log' /etc/rsyslog.conf; then return diff --git a/src/freedombone-utils-postgresql b/src/freedombone-utils-postgresql index 2656a240..69c85211 100755 --- a/src/freedombone-utils-postgresql +++ b/src/freedombone-utils-postgresql @@ -29,6 +29,26 @@ # Set this when calling backup and restore commands USE_POSTGRESQL= POSTGRESQL_PACKAGES='postgresql-9.6 postgresql-contrib-9.6 postgresql-client' +POSTGRESQL_VERSION=9.6 + +function turn_off_postgresql_logging { + if [ ! -f /etc/postgresql/$POSTGRESQL_VERSION/main/postgresql.conf ]; then + return + fi + sed -i 's|#log_destination|log_destination|g' /etc/postgresql/$POSTGRESQL_VERSION/main/postgresql.conf + sed -i "s|log_destination.*|log_destination = 'syslog'|g" /etc/postgresql/$POSTGRESQL_VERSION/main/postgresql.conf + if [ -d /var/log/postgresql ]; then + $REMOVE_FILES_COMMAND /var/log/postgresql/* + fi +} + +function turn_on_postgresql_logging { + if [ ! -f /etc/postgresql/$POSTGRESQL_VERSION/main/postgresql.conf ]; then + return + fi + sed -i 's|log_destination|#log_destination|g' /etc/postgresql/$POSTGRESQL_VERSION/main/postgresql.conf + sed -i "s|log_destination.*|log_destination = 'stderr'|g" /etc/postgresql/$POSTGRESQL_VERSION/main/postgresql.conf +} function store_original_postgresql_password { if [ ! -f /root/.postgresqloriginal ]; then