[ovs-dev] [python vlog 6/6] Properly reopen python daemon log files after rotation.
Ethan Jackson
ethan at nicira.com
Mon May 14 18:20:44 UTC 2012
Looks good, thanks.
Ethan
On Tue, May 1, 2012 at 2:28 PM, Ben Pfaff <blp at nicira.com> wrote:
> 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 at nicira.com>
> ---
> 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 6620a09..8b04240 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 1a08fa9..00066c6 100644
> --- a/rhel/etc_logrotate.d_openvswitch
> +++ b/rhel/etc_logrotate.d_openvswitch
> @@ -1,4 +1,4 @@
> -# Copyright (C) 2009, 2010, 2011 Nicira Networks, Inc.
> +# Copyright (C) 2009, 2010, 2011, 2012 Nicira Networks, 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 c1ead14..00066c6 100644
> --- a/xenserver/etc_logrotate.d_openvswitch
> +++ b/xenserver/etc_logrotate.d_openvswitch
> @@ -1,4 +1,4 @@
> -# Copyright (C) 2009, 2010, 2011 Nicira Networks, Inc.
> +# Copyright (C) 2009, 2010, 2011, 2012 Nicira Networks, 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
> }
> --
> 1.7.2.5
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
More information about the dev
mailing list