Properly reopen python daemon log files after rotation.
authorBen Pfaff <blp@nicira.com>
Tue, 1 May 2012 21:27:06 +0000 (14:27 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 22 May 2012 17:17:07 +0000 (10:17 -0700)
The OVS Python daemons weren't reopening their log files after rotation, so
all the log information after the second rotation was lost.

Signed-off-by: Ben Pfaff <blp@nicira.com>
debian/openvswitch-switch.logrotate
rhel/etc_logrotate.d_openvswitch
xenserver/etc_logrotate.d_openvswitch

index 6620a09..8b04240 100644 (file)
@@ -7,11 +7,8 @@
     rotate 30
     postrotate
     # Tell Open vSwitch daemons to reopen their log files
-    if [ -e /var/run/openvswitch/ovs-vswitchd.pid ]; then
-        ovs-appctl -t ovs-vswitchd vlog/reopen
-    fi
-    if [ -e /var/run/openvswitch/ovsdb-server.pid ]; then
-        ovs-appctl -t ovsdb-server vlog/reopen
-    fi
+    for pidfile in `cd /var/run/openvswitch && echo *.pid`; do
+        ovs-appctl -t "${pidfile%%.pid}" vlog/reopen
+    done
     endscript
 }
index 2fdd6c4..46b94b9 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2009, 2010, 2011 Nicira, Inc.
+# Copyright (C) 2009, 2010, 2011, 2012 Nicira, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
        missingok
        postrotate
        # Tell Open vSwitch daemons to reopen their log files
-       if [ -e /var/run/openvswitch/ovs-vswitchd.pid ]; then
-           /usr/bin/ovs-appctl -t ovs-vswitchd vlog/reopen
-       fi
-       if [ -e /var/run/openvswitch/ovsdb-server.pid ]; then
-           /usr/bin/ovs-appctl -t ovsdb-server vlog/reopen
-       fi
+        for pidfile in `cd /var/run/openvswitch && echo *.pid`; do
+            ovs-appctl -t "${pidfile%%.pid}" vlog/reopen
+        done
        endscript
 }
index a677ca6..46b94b9 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2009, 2010, 2011 Nicira, Inc.
+# Copyright (C) 2009, 2010, 2011, 2012 Nicira, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
        missingok
        postrotate
        # Tell Open vSwitch daemons to reopen their log files
-       if [ -e /var/run/openvswitch/ovs-vswitchd.pid ]; then
-           /usr/bin/ovs-appctl -t ovs-vswitchd vlog/reopen
-       fi
-       if [ -e /var/run/openvswitch/ovsdb-server.pid ]; then   
-           /usr/bin/ovs-appctl -t ovsdb-server vlog/reopen
-       fi
+        for pidfile in `cd /var/run/openvswitch && echo *.pid`; do
+            ovs-appctl -t "${pidfile%%.pid}" vlog/reopen
+        done
        endscript
 }