Skip to content

Commit

Permalink
OpenvSwitch logrotate: Use ctl file path as target in ovs-appctl to r…
Browse files Browse the repository at this point in the history
…eset logs

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]>
Signed-off-by: Ben Pfaff <[email protected]>
Acked-by: Mark Michelson <[email protected]>
  • Loading branch information
numansiddique authored and blp committed Nov 27, 2017
1 parent 8c8a820 commit bbf219e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions debian/openvswitch-switch.logrotate
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
4 changes: 2 additions & 2 deletions rhel/etc_logrotate.d_openvswitch
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bbf219e

Please sign in to comment.