From: Numan Siddique <[email protected]>

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 <[email protected]>
Signed-off-by: Numan Siddique <[email protected]>
---
 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

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to