From patchwork Thu Apr 13 17:47:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 750553 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3w3pDB4scGz9sN9 for ; Fri, 14 Apr 2017 03:48:10 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 37861BCA; Thu, 13 Apr 2017 17:48:08 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 18246BC3 for ; Thu, 13 Apr 2017 17:48:07 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 5A503A7 for ; Thu, 13 Apr 2017 17:48:06 +0000 (UTC) Received: from mfilter2-d.gandi.net (mfilter2-d.gandi.net [217.70.178.140]) by relay2-d.mail.gandi.net (Postfix) with ESMTP id 1F201C5A50; Thu, 13 Apr 2017 19:48:05 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter2-d.gandi.net Received: from relay2-d.mail.gandi.net ([IPv6:::ffff:217.70.183.194]) by mfilter2-d.gandi.net (mfilter2-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id mX91lXm4cEzY; Thu, 13 Apr 2017 19:48:03 +0200 (CEST) X-Originating-IP: 173.228.112.23 Received: from sigabrt.gateway.sonic.net (173-228-112-23.dsl.dynamic.fusionbroadband.com [173.228.112.23]) (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 25BDEC5A51; Thu, 13 Apr 2017 19:48:00 +0200 (CEST) From: Ben Pfaff To: dev@openvswitch.org Date: Thu, 13 Apr 2017 10:47:55 -0700 Message-Id: <20170413174755.1131-1-blp@ovn.org> X-Mailer: git-send-email 2.10.2 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ben Pfaff Subject: [ovs-dev] [PATCH] debian, xenserver: Update logrotate config to match RHEL. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org 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 Signed-off-by: Ben Pfaff Acked-by: Gurucharan Shetty --- 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 }