Matrix logging

This commit is contained in:
Bob Mottram 2017-08-10 14:27:04 +01:00
parent b5b84a7127
commit daa36d9f5a
1 changed files with 12 additions and 2 deletions

View File

@ -64,7 +64,9 @@ matrix_variables=(ONION_ONLY
function logging_on_matrix {
if [ -f /var/lib/matrix/homeserver.yaml ]; then
sed -i 's|log_file:.*|log_file: /etc/matrix/homeserver.log|g' /var/lib/matrix/homeserver.yaml
if ! grep -q "log_file: /etc/matrix/homeserver.log" /var/lib/matrix/homeserver.yaml; then
sed -i 's|log_file:.*|log_file: /etc/matrix/homeserver.log|g' /var/lib/matrix/homeserver.yaml
fi
if ! grep -q "#log_config:" /var/lib/matrix/homeserver.yaml; then
sed -i 's|log_config:|#log_config:|g' /var/lib/matrix/homeserver.yaml
fi
@ -73,7 +75,9 @@ function logging_on_matrix {
function logging_off_matrix {
if [ -f /var/lib/matrix/homeserver.yaml ]; then
sed -i 's|log_file:.*|log_file: /dev/null|g' /var/lib/matrix/homeserver.yaml
if ! grep -q "log_file: /dev/null" /var/lib/matrix/homeserver.yaml; then
sed -i 's|log_file:.*|log_file: /dev/null|g' /var/lib/matrix/homeserver.yaml
fi
if ! grep -q "#log_config:" /var/lib/matrix/homeserver.yaml; then
sed -i 's|log_config:|#log_config:|g' /var/lib/matrix/homeserver.yaml
fi
@ -83,6 +87,12 @@ function logging_off_matrix {
if [ -f /etc/matrix/homeserver.log.1 ]; then
$REMOVE_FILES_COMMAND /etc/matrix/homeserver.log.1
fi
if [ -f /etc/matrix/homeserver.log.2 ]; then
$REMOVE_FILES_COMMAND /etc/matrix/homeserver.log.2
fi
if [ -f /etc/matrix/homeserver.log.3 ]; then
$REMOVE_FILES_COMMAND /etc/matrix/homeserver.log.3
fi
fi
}