xenserver: gate all logrotate reopens on presence of a pid file
authorIan Campbell <Ian.Campbell@citrix.com>
Tue, 30 Mar 2010 08:34:29 +0000 (09:34 +0100)
committerBen Pfaff <blp@nicira.com>
Tue, 30 Mar 2010 16:42:12 +0000 (09:42 -0700)
This probably only makes a difference in the case where you have vswitch
installed but (deliberately) not running _and_ you happen to have ovs-* logs big
enough to be worth rotating. Very much an edge case.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
xenserver/etc_logrotate.d_openvswitch

index f87282c..ed3592f 100644 (file)
        missingok
        postrotate
        # Tell Open vSwitch daemons to reopen their log files
-       /usr/bin/ovs-appctl -t ovs-vswitchd vlog/reopen
-       /usr/bin/ovs-appctl -t ovsdb-server vlog/reopen
+       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
        if [ -e /var/run/openvswitch/ovs-brcompatd.pid ]; then
                /usr/bin/ovs-appctl -t ovs-brcompatd vlog/reopen
        fi