Skip to content
Snippets Groups Projects
Commit 54f4a246 authored by Bob Mottram's avatar Bob Mottram
Browse files

Move postgresql logging functions

parent f2654245
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment