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 f87282c32b4967db0ec2fc92d0dc2e43a6a6235c..ed3592f2cde6c86599156c7589d3d2cb4896d1dd 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