Commit 618a5b45ae8b ("rhel: Avoid logrotate error if /var/run/openvswitch
does not exist") updated the RHEL logrotate configuration.  This commit
makes similar changes for Debian, by synchronizing with the RHEL version.

In particular:

    - Indent to match logrotate.conf(5) examples.

    - Use "sharedscripts" flag, because the postrotate script only needs to
      run once regardless of the number of rotations.

    - Drop "delaycompress", because the postrotate script does make daemons
      reopen their log files.

    - Ignore errors calling vlog/reopen.

Also make similar changes to the xenserver logrotate script.  I really
don't know if anyone uses the xenserver packaging anymore though.

CC: Timothy Redaelli <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
---
 debian/openvswitch-switch.logrotate   | 14 +++++++-------
 xenserver/etc_logrotate.d_openvswitch | 22 ++++++++++++----------
 2 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/debian/openvswitch-switch.logrotate 
b/debian/openvswitch-switch.logrotate
index a7a71bdd90ad..7752af90cfed 100644
--- a/debian/openvswitch-switch.logrotate
+++ b/debian/openvswitch-switch.logrotate
@@ -1,16 +1,16 @@
 /var/log/openvswitch/*.log {
     daily
     compress
+    sharedscripts
     create 640 root adm
-    delaycompress
     missingok
     rotate 30
     postrotate
-    # Tell Open vSwitch daemons to reopen their log files
-    if [ -d /var/run/openvswitch ]; then
-        for pidfile in `cd /var/run/openvswitch && echo *.pid`; do
-            ovs-appctl -t "${pidfile%%.pid}" vlog/reopen
-        done
-    fi
+       # Tell Open vSwitch daemons to reopen their log files
+       if [ -d /var/run/openvswitch ]; then
+           for pidfile in `cd /var/run/openvswitch && echo *.pid`; do
+               ovs-appctl -t "${pidfile%%.pid}" vlog/reopen 2>/dev/null || :
+           done
+       fi
     endscript
 }
diff --git a/xenserver/etc_logrotate.d_openvswitch 
b/xenserver/etc_logrotate.d_openvswitch
index 73751d4578b0..cd7b3a9d569d 100644
--- a/xenserver/etc_logrotate.d_openvswitch
+++ b/xenserver/etc_logrotate.d_openvswitch
@@ -1,4 +1,4 @@
-# Copyright (C) 2009, 2010, 2011, 2012 Nicira, Inc.
+# Copyright (C) 2009, 2010, 2011, 2012, 2017 Nicira, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
@@ -6,14 +6,16 @@
 # without warranty of any kind.
 
 /var/log/openvswitch/*.log {
-       daily
-       compress
-       sharedscripts
-       missingok
-       postrotate
+    daily
+    compress
+    sharedscripts
+    missingok
+    postrotate
        # Tell Open vSwitch daemons to reopen their log files
-        for pidfile in `cd /var/run/openvswitch && echo *.pid`; do
-            ovs-appctl -t "${pidfile%%.pid}" vlog/reopen
-        done
-       endscript
+        if [ -d /var/run/openvswitch ]; then
+           for pidfile in `cd /var/run/openvswitch && echo *.pid`; do
+               ovs-appctl -t "${pidfile%%.pid}" vlog/reopen 2>/dev/null || :
+           done
+       fi
+    endscript
 }
-- 
2.10.2

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to