Move postgresql logging functions

This commit is contained in:
Bob Mottram 2018-04-19 11:39:26 +01:00
parent f2654245aa
commit 54f4a246ed
2 changed files with 20 additions and 19 deletions

View File

@ -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

View File

@ -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