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

Turn off postgresql logging

parent b33deeb0
No related branches found
No related tags found
No related merge requests found
......@@ -90,6 +90,22 @@ 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
}
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
......@@ -199,6 +215,7 @@ if [[ "$1" == "on" || "$1" == "On" || "$1" == "ON" ]]; then
fi
fi
turn_on_rsys_logging
turn_on_postgresql_logging
else
turn_logging_off
......@@ -256,6 +273,7 @@ else
fi
fi
turn_off_rsys_logging
turn_off_postgresql_logging
fi
if [ -d /etc/exim4 ]; then
......@@ -301,5 +319,8 @@ fi
if [ -d /etc/matrix ]; then
systemctl restart matrix
fi
if [ -d /etc/postgresql ]; then
systemctl restart postgresql
fi
exit 0
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