[ovs-dev] [PATCH v2 2/2] OpenvSwitch logrotate: Use ctl file path as target in ovs-appctl to reset logs

nusiddiq at redhat.com nusiddiq at redhat.com
Wed Nov 8 08:59:07 UTC 2017


From: Numan Siddique <nusiddiq at redhat.com>

Presently, logrotate script, searches for the pid files in /var/log/openvswitch
and passes the pid file name (without .pid) as target to ovs-appctl. This approach
doesn't work for OVN DB servers since the ctl files are generated as "ovnnb_db.ctl"
and "ovnsb_db.ctl". So search for the .ctl files instead and use them as target to
ovs-appctl.

Suggested-by: Ben Pfaff <blp at ovn.org>
Signed-off-by: Numan Siddique <nusiddiq at redhat.com>
---
 debian/openvswitch-switch.logrotate | 6 +++---
 rhel/etc_logrotate.d_openvswitch    | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/debian/openvswitch-switch.logrotate b/debian/openvswitch-switch.logrotate
index 7752af90c..802d36566 100644
--- a/debian/openvswitch-switch.logrotate
+++ b/debian/openvswitch-switch.logrotate
@@ -8,9 +8,9 @@
     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 2>/dev/null || :
-	    done
+            for ctl in /var/run/openvswitch/*.ctl; do
+                ovs-appctl -t "$ctl" vlog/reopen 2>/dev/null || :
+            done
 	fi
     endscript
 }
diff --git a/rhel/etc_logrotate.d_openvswitch b/rhel/etc_logrotate.d_openvswitch
index d93a56e51..ed7d733c9 100644
--- a/rhel/etc_logrotate.d_openvswitch
+++ b/rhel/etc_logrotate.d_openvswitch
@@ -13,8 +13,8 @@
     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 2>/dev/null || :
+            for ctl in /var/run/openvswitch/*.ctl; do
+                ovs-appctl -t "$ctl" vlog/reopen 2>/dev/null || :
             done
         fi
     endscript
-- 
2.13.5



More information about the dev mailing list