diff --git a/src/freedombone-app-xmpp b/src/freedombone-app-xmpp index 2ae11a3b..832cf9d9 100755 --- a/src/freedombone-app-xmpp +++ b/src/freedombone-app-xmpp @@ -65,19 +65,23 @@ function logging_on_xmpp { mkdir /var/log/prosody chown root:adm /var/log/prosody fi - sed -i 's|info = "/dev/null";|info = "/var/log/prosody/prosody.log";|g' /etc/prosody/prosody.cfg.lua - sed -i 's|error = "/dev/null";|error = "/var/log/prosody/prosody.err";|g' /etc/prosody/prosody.cfg.lua - sed -i 's|levels = { "error" }; to = "/dev/null";|levels = { "error" }; to = "syslog";|g' /etc/prosody/prosody.cfg.lua + if ! grep -q "/var/log/prosody/prosody.log" /etc/prosody/prosody.cfg.lua; then + sed -i 's|info = "/dev/null";|info = "/var/log/prosody/prosody.log";|g' /etc/prosody/prosody.cfg.lua + sed -i 's|error = "/dev/null";|error = "/var/log/prosody/prosody.err";|g' /etc/prosody/prosody.cfg.lua + sed -i 's|levels = { "error" }; to = "/dev/null";|levels = { "error" }; to = "syslog";|g' /etc/prosody/prosody.cfg.lua + fi fi } function logging_off_xmpp { if [ -d /etc/prosody ]; then - sed -i 's|info = "/var/log/prosody/prosody.log";|info = "/dev/null";|g' /etc/prosody/prosody.cfg.lua - sed -i 's|error = "/var/log/prosody/prosody.err";|error = "/dev/null";|g' /etc/prosody/prosody.cfg.lua - sed -i 's|levels = { "error" }; to = "syslog";|levels = { "error" }; to = "/dev/null";|g' /etc/prosody/prosody.cfg.lua - $REMOVE_FILES_COMMAND /var/log/prosody/* - rm -rf /var/log/prosody + if grep -q "/var/log/prosody/prosody.log" /etc/prosody/prosody.cfg.lua; then + sed -i 's|info = "/var/log/prosody/prosody.log";|info = "/dev/null";|g' /etc/prosody/prosody.cfg.lua + sed -i 's|error = "/var/log/prosody/prosody.err";|error = "/dev/null";|g' /etc/prosody/prosody.cfg.lua + sed -i 's|levels = { "error" }; to = "syslog";|levels = { "error" }; to = "/dev/null";|g' /etc/prosody/prosody.cfg.lua + $REMOVE_FILES_COMMAND /var/log/prosody/* + rm -rf /var/log/prosody + fi fi }