Turn off postgresql logging
This commit is contained in:
parent
b33deeb016
commit
be74c3040a
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue