From b54c9e972e74ed51ce8a6d0a071f253f48432d6c Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 1 May 2012 14:27:06 -0700 Subject: [PATCH] Properly reopen python daemon log files after rotation. 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 --- debian/openvswitch-switch.logrotate | 9 +++------ rhel/etc_logrotate.d_openvswitch | 11 ++++------- xenserver/etc_logrotate.d_openvswitch | 11 ++++------- 3 files changed, 11 insertions(+), 20 deletions(-) diff --git a/debian/openvswitch-switch.logrotate b/debian/openvswitch-switch.logrotate index 6620a094..8b042407 100644 --- a/debian/openvswitch-switch.logrotate +++ b/debian/openvswitch-switch.logrotate @@ -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 } diff --git a/rhel/etc_logrotate.d_openvswitch b/rhel/etc_logrotate.d_openvswitch index 2fdd6c46..46b94b9f 100644 --- a/rhel/etc_logrotate.d_openvswitch +++ b/rhel/etc_logrotate.d_openvswitch @@ -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 @@ -10,11 +10,8 @@ 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 } diff --git a/xenserver/etc_logrotate.d_openvswitch b/xenserver/etc_logrotate.d_openvswitch index a677ca6e..46b94b9f 100644 --- a/xenserver/etc_logrotate.d_openvswitch +++ b/xenserver/etc_logrotate.d_openvswitch @@ -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 @@ -10,11 +10,8 @@ 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 } -- 2.30.2