Package: prosody
Version: 0.10.0-1
Severity: normal
Tags: patch

Dear Maintainer,

When prosody is not running, the postrotate script of
/etc/logrotate.d/prosody exits with code 1 and causes logrotate to print
the following error message:

    /etc/cron.daily/logrotate:
    error: error running shared postrotate script for 
'/var/log/prosody/prosody.log /var/log/prosody/prosody.err '
    run-parts: /etc/cron.daily/logrotate exited with return code 1

Since prosody is not running, there is no need to reload its
configuration and the postrotate script should exit without error.  The
attached patch makes this change.

Cheers,
Kevin


-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'testing-debug'), (500, 'unstable'), 
(101, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.14.12-kevinoid1 (SMP w/4 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8), 
LANGUAGE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages prosody depends on:
ii  adduser                     3.116
ii  libc6                       2.26-4
ii  libidn11                    1.33-2.1
ii  libssl1.1                   1.1.0g-2
ii  lsb-base                    9.20170808
ii  lua-bitop [lua5.1-bitop]    1.0.2-4
ii  lua-expat [lua5.1-expat]    1.3.0-4
pn  lua-filesystem              <none>
ii  lua-socket [lua5.1-socket]  3.0~rc1+git+ac3201d-3
pn  lua5.1                      <none>
pn  lua5.1-filesystem           <none>
pn  lua5.1-sec                  <none>
ii  ssl-cert                    1.0.39

Versions of packages prosody recommends:
pn  lua5.1-event  <none>

Versions of packages prosody suggests:
pn  lua-dbi-mysql       <none>
pn  lua-dbi-postgresql  <none>
pn  lua-dbi-sqlite3     <none>
pn  lua-zlib            <none>
>From fa736e4f89990d0fb5055bbfe34a5efe6df207d5 Mon Sep 17 00:00:00 2001
Message-Id: 
<fa736e4f89990d0fb5055bbfe34a5efe6df207d5.1517124523.git.ke...@kevinlocke.name>
From: Kevin Locke <ke...@kevinlocke.name>
Date: Sun, 28 Jan 2018 00:26:08 -0700
Subject: [PATCH] Avoid postrotate error when prosody is not running

When prosody is not running, /var/run/prosody/prosody.pid will not
exist.  This caused the postrotate script to exit with code 1 and caused
logrotate to print the following error message:

    /etc/cron.daily/logrotate:
    error: error running shared postrotate script for 
'/var/log/prosody/prosody.log /var/log/prosody/prosody.err '
    run-parts: /etc/cron.daily/logrotate exited with return code 1

Fix this by exiting with code 0 when the PID file does not exist, since
reloading prosody is not required in this case.

Signed-off-by: Kevin Locke <ke...@kevinlocke.name>
---
 debian/prosody.logrotate | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/prosody.logrotate b/debian/prosody.logrotate
index c13ccd7..1869e3d 100644
--- a/debian/prosody.logrotate
+++ b/debian/prosody.logrotate
@@ -5,7 +5,7 @@
        delaycompress
        create 640 prosody adm
        postrotate
-               [ -e /var/run/prosody/prosody.pid ] && /etc/init.d/prosody 
reload > /dev/null
+               [ ! -e /var/run/prosody/prosody.pid ] || /etc/init.d/prosody 
reload > /dev/null
        endscript
        sharedscripts
        missingok
-- 
2.15.1

Reply via email to